Linux
Server systems generally MacOS
come with a Python2
development environment just like . Here I want to install a Python3
development environment again as follows.
Install python3
The first step is to install dependencies
yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel
Step 2. Install gcc
the compiler
yum install gcc -y
The third step is to install a libffi-devel
package, otherwise an error will be reported when compiling the source code package later.
yum install libffi-devel -y
Step 4. Enter the /usr/local/ directory
cd /usr/local/
Step 5: Find the corresponding development version. I use it here 3.7.2
, so use the following command to download it directly:
wget https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tgz
Step 6: Unzip the downloaded file package:
tar -zxf Python-3.7.2.tgz
Step 7: Delete the compressed package after decompression is complete:
rm Python-3.7.2.tgz
Step 8. Change the directory Python-3.7.2 to Python3
mv Python-3.7.2 Python3
Step 9. Enter the python3 folder
cd python3
Step 10: Enter the following commands in order to compile and install the source code:
./configure --prefix=/usr/local/python3
make
make install
Step 11: Create a soft connection
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
After completing the above eleven steps in sequence, python3
the installation is complete.
Enter python3
to test:
When you see this interface after entering this command, it means that python3
the installation is complete.
Install pip3
The first step, installationsetuptools
python3
Enter directly in the directory:
wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-19.6.tar.gz
The second step, decompressionsetuptools
tar -zxvf setuptools-19.6.tar.gz
Part 3: Delete setuptools
the compressed package
rm setuptools-19.6.tar.gz
Step 4: Enter setuptools
the directory
cd setuptools-19.6/
Step 5: python3
Compile through packaging
python3 setup.py build
Step 6: Install dependencies by executing the file
python3 setup.py install
Step 7: Create pip3
a soft connection
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
Step 8. Check pip3
the version of
pip3 -V
What I installed here is currently the latest version. If it is the latest version, the installation is complete. If you find that it is not the latest version, just enter the update command:
pip3 install --upgrade pip
At this point, Python3
the pip3
complete installation is complete