Preface: It is recommended to use version 3.6 and above, the system comes with python2 do not uninstall, some system commands to use, 2 and 3 can coexist!
I. Linux installation of python3 (Python-3.6.8)
1. Check to see if python3 is installed.
python3 -V
2. Download the installation package
1、Download via wget command
wget https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tgz
2、Directly into the Python website to download the installation package, uploaded to the
https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tgz
3. Extract the installation package to the specified directory, and rename the files
# Unzip
tar -zxvf Python-3.6.8.tgz -C /usr/local/
# Rename
mv Python-3.6.8/ python3
4. Installation of dependencies
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make
Install the dependencies needed by python. On success (Complete!)
If python is version 3.7, you also need to install libffi-devel
5. Compile and install
./configure --prefix=/usr/local/Python3
make
make install
Here -prefix=/usr/local/Python3 is the installation directory of Python, be sure to change it, otherwise there will be no bin file in the installation directory of Python.
6. Create a soft link between Python3 and pip3
Ln -s/usr/local/Python3 / bin/python3.6 / usr/bin/Python3 # Python3 soft links
Ln -s/usr/local/Python3 / bin/pip3.6 / usr/bin/pip3 # pip3 soft links
Note: If the soft link was created incorrectly, it can be removed by the following statement
1. ln -s /usr/local/Python3/bin/pip3.8 /usr/bin/pip3 # soft link = address + soft link name
2. rm -r /usr/bin/pip3 # /usr/bin/pip3 for the soft link name
7. Check availability
python3 --version
pip3 --version
Installation completed
Second, Windows installation of python3 (Python-3.6.8)
1.Download
1. AccessPythonOfficial website home page, click Downloads, select Windows, select the corresponding version to download
2. Installation
Once downloaded, the installation process is the same as a normal installation of Windows software, double-click to install.
1. Select Custom Installation and check Configure Python environment variables.
2. Select the installation path
3. Successful installation
5. Command Line Verification
If execution of python -V prompts for a command that is not internal or external to —-, configure the following environment variables
3. Configure environment variables
Go to Settings-About-Advanced System Settings
Click on Environment Variables
Find the selection path editor
Insert the Python installation path and Python’s Scripts path (depending on your installation)
D:\Python\Python36\Scripts
D:\Python\Python36
Command Line Verification
End of installation!