Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the method of setting up the Python installation environment

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "what is the method of building the Python installation environment". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the method of building the Python installation environment".

Install Python under windows7/10 + Python3.6 + Pycharm 1 and windows

First, go to the official website to download the installation files. Select windows under download instead of directly selecting the button on the right, so you cannot choose the format of the download file:

Note: Python versions above 3.5 + do not support windows xp and lower operating systems, and sp1 packages must be installed on windows 7 systems, which you must pay attention to.

After entering the version selection page, click the following figure and select:

Among them, the file name of Python 3.6.1-2017-03-21 is a stable release version, belongs to the object of our choice, and there are several optional file types under it. Usually we choose 64-bit, if we can only use 32-bit, then choose in 1-3. Web-based is a network-based installation that requires networking. Executable is an executable file, which is our best choice. It can be saved locally and installed when the network is disconnected. Embeddable zip is an embedded installation, which is usually not required for embedded development. The last one is the help file under windows, which does not require special attention.

Click on the link and wait patiently for the download. Students with slow network speed can consider domestic mirror sites or software sites, please download by yourself.

After the download is complete, we will get an installation file named python-3.6.1-amd64, run the file, and we will see the installation window:

Note: since I already have Python3.6.1 on my local machine, the image above shows a makeover of the installation I copied from elsewhere, but it doesn't affect my use. In the figure above, it is recommended to select Customize installation, and then use a path similar to C:\ Python36 for future use. Pay attention to the Add Python3.6 to PATH option below and be sure to check it, which will save you the effort of configuring system environment variables.

If you already have Python3.6.1 installed on your machine, just like mine, or if you are installing 3.6.2, the following upgrade screen will appear and the upgrade process will not be repeated:

Installation verification:

If there are no errors along the way, use the WIN+ r key to enter the CMD interface and run python-V (uppercase V). If the execution results show python 3.6.1, the installation is successful.

Or type python directly and enter the interactive interface shown in the following figure, which also indicates that the installation is successful.

If an error pops up: python is not an internal or external command, nor is it a runnable program or batch file. Either it is not installed properly, or the environment variable is not set correctly. Follow the prompts in the following figure to set the environment variable.

What do python, python2, python27, python3, python36 all mean?

Python supports the coexistence of multiple versions. For many beginners, if there are too many Python versions in the machine, these python executable programs will appear. They are actually shortcuts or aliases that point to a specific python executor. In order to distinguish between version 2.x and version 3.x, a specific version number is usually added after the python. But this is not mandatory, and if you point python2 to python3's interpreter, unexpected errors may occur. What is particularly prone to this error is the python command, which does not have a version number, and you have no idea which version it points to until it is executed. The only way to detect it is to run it on the command line, and then follow the prompts to check the version information.

2. Install Python under Linux

Basically, most Linux distributions have Python installed by default. However, it is possible to install python2.7, such as Centos6.7, whose yum component is based on python. For development programmers, we usually use more Ubuntu distribution, because its software update, installation is more convenient, user-friendly, more suitable for development, and Centos is more suitable as a production server.

In Ubuntu, it is recommended to use version 16.04 LTS, which can be installed directly using sudo apt-get install python2.7 pythont2.7-dev or sudo apt-get install python3.5 pythont3.5-dev. However, it is often not possible to install the latest version of python in this way, so we may also need to install it using python source code.

Source code installation:

Select source code on the home page of the official website, go to the page, and download the source code:

Either way, copy the source package to the home directory of the ubuntu system.

Perform tar-zxvf Python-3.6.1.tar to extract the file:

Go to the Python-3.6.1 directory and run. / configure-prefix=/usr/local. Here, all the installation files of python3.6.1 will be concentrated in this directory by specifying the prefix parameter to / usr/local, which is convenient for us to delete and modify later. Run sudo make & & sudo make install after configure is successful, and if all goes well, you will see the following figure, indicating that the installation is complete.

Linux-based program installation, especially source code installation, is a complex and headache. Because everyone's distribution and software environment are different, there may be a variety of problems in the process of installation, which basically have nothing to do with Python and need rich linux management skills to solve. For example, if you are sometimes prompted for a lack of zlib packages, you need to sudo apt-get install zlib1g-dev first. If the ssl module is missing, the resolution process is more complex. If you encounter these problems, please do your own Baidu, and then record the process of solving it, so that you can share it with you later.

Verify the installation:

Similar to windows, run / usr/local/bin/python3, if you can enter the interactive interface, the installation is successful.

Thank you for your reading, the above is the content of "what is the method of building the Python installation environment". After the study of this article, I believe you have a deeper understanding of what the method of building the Python installation environment is, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report