Python download and installation and environment construction

1. Install Anaconda on Windows

Download link: https://pan.baidu.com/s/1jpqwurCjolkHaXHzn618vQ

Extraction code:m9pj

If the operating system is Win10, please right-click on the installation file and select "Run as administrator" (previously, on Win10, installation without administrator rights caused the installation of Scrapy crawler to fail later)

After opening, you can continue to install in the next step. You can choose the installation location and whether to configure environment variables in the middle.

Test whether Python is installed successfully on the command line:python
Insert picture description here

2. Development environment deployment

The Python environment installation can be installed by installing the Python interpreter and the libraries that need to be used separately or by choosing an integrated distribution installation tool to install

The advantages of separate installation are fast and take up less space. But the problem is that there are many versions of Python, and there will be compatibility problems between libraries of different versions. Generally, this installation method is used when using Python to develop website applications

In the field of data science, Anaconda is commonly used to install the Python development environment. Anaconda integrates many libraries and software commonly used in data analysis, such as NumPy, Pandas, Matplotlib and JupyterNoteBook, etc.

2.1、Turtle Demo

Turtle Demo is a demonstration program that comes with Python, whether it is an Anaconda installation or a native Python installation will have this program. There are some good drawing examples in this program

2.2、Jupyter NoteBook

Jupyter Notebook is opened in the form of a web page. You can write code and
run the code directly on the web page, and the running result of the code will also be displayed directly under the code block. If you need to write a description document during the programming process, you can write it directly on the same page, which is convenient for timely description and explanation.

Jupyter NoteBook is widely used in the field of data analysis, but it is not very convenient to use Jupyter NoteBook in program exceptions and Debug code.

Use Anaconda to install Python comes with Jupyter NoteBook, which can be started here. The default startup creation path is the directory entered in the command.

Jupyter NoteBook modify the default path method:

Find the shortcut of Jupyter NoteBook, right-click and select properties, you can see %USERPROFILE% here, and the configuration file path pointed to is the starting file path address.
Insert picture description here
There are two ways to modify the default path. One is to modify the specified path directly in the properties, and the other is to enter the configuration file pointed to by %USERPROFILE% to modify it. Here we select the configuration file modification:

Go to its location path, find .jupyterand enter:

Edit jupyter_notebook_config.pythe file
Insert picture description here
add the following:

c.NotebookApp.notebook_dir = 'D:\Anaconda\python'

Insert picture description here
Start again and find that no matter where the cmd is started, the files generated by jupyter notebook
are in the default path we specified

Set code prompt function:

Open Anaconda Navigator, click Environments -> base (root) -> Open Terminal:
Insert picture description here
Enter the following 4 commands in the pop-up command box:

pip install jupyter_contrib_nbextensions
jupyter contrib nbextension install --user
pip install jupyter_nbextensions_configurator
jupyter nbextensions_configurator enable --user

Insert picture description here
Check Hinterland to check the
Insert picture description here
following positions, and then perform the test, there is already a code hint
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_42578036/article/details/113308834