Home > Article > Backend Development > How to install python3
Install Python3 on Unix&Linux platform:
The following are simple steps to install Python on Unix&Linux platform:
Open a WEB browser and visit https://www.python.org/downloads/source/ to select the source code compression package suitable for Unix/Linux. Download and decompress the compressed package Python-3.x.x.tgz, 3.x.x is the corresponding version number you downloaded. If you need to customize some options, modify Modules/Setup
Take Python3.6.1 version as an example:
# tar -zxvf Python-3.6.1.tgz # cd Python-3.6.1 # ./configure # make && make install
Check whether Python3 is available normally:
# python3 -V Python 3.6.1
Installing Python on Window platform:
The following are simple steps to install Python on Window platform.
Open the WEB browser and visit https://www.python.org/downloads/windows/. Generally, download the executable installer. x86 means a 32-bit machine, and x86-64 means a 64-bit machine.
Remember to check Add Python 3.6 to PATH.
Press the Win R key, enter cmd to bring up the command prompt, enter python:
Environment Variable configuration
Programs and executable files can be in many directories, and these paths are most likely not in the search path provided by the operating system for executable files.
Path (path) is stored in an environment variable, which is a named string maintained by the operating system. These variables contain information about available command line interpreters and other programs.
The path variable in Unix or Windows is PATH (UNIX is case-sensitive, Windows is not case-sensitive).
In Mac OS, the installation path of python is changed during the installation process. If you need to reference Python from another directory, you must add the Python directory to the path.
Set environment variables in Unix/Linux
In csh shell: Enter
setenv PATH "$PATH:/usr/local/bin/python"
and press Enter.
In bash shell (Linux) enter
PATH="$PATH:/usr/local/bin/python"
and press Enter.
Note: /usr/local/bin/python is the installation directory of Python.
Set environment variables in Windows
Add the Python directory in the environment variables:
In the command prompt box (cmd): enter
path=%path%;C:\Python
Press "Enter".
Note: C:\Python is the installation directory of Python.
can also be set in the following ways:
右键点击"计算机",然后点击"属性"然后点击"高级系统设置"选择"系统变量"窗口下面的"Path",双击即可!然后在"Path"行,添加python安装路径即可(我的D:\Python32),所以在后面,添加该路径即可。 ps:记住,路径直接用分号";"隔开!最后设置成功以后,在cmd命令行,输入命令"python",就可以有相关显示。
安装 Python3,执行一下命令,安装 Python3 并查看解释器是否正常工作
sudo apt-get install python3 python3 --version
出现以下画面则说明 Python3 已经成功安装
相关推荐:《Python视频教程》
The above is the detailed content of How to install python3. For more information, please follow other related articles on the PHP Chinese website!