Install Python 3.5.2 under CentOS 6.5 (coexist with Python2)

  • 2020-06-01 10:21:34
  • OfStack

This paper mainly introduces the installation of CentOS 6.5 and the coexistence of Python 3.5.2 with Python2, which is Shared for your reference and learning. The following is a detailed introduction:

The installation steps are as follows

1. Prepare the compiled environment (if the environment is wrong, you may encounter various problems, such as wget's inability to download the https linked files)

yum groupinstall 'Development Tools'
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel

2. Download the Python 3.5 code package


3, compile,

tar Jxvf Python-3.5.2.tar.xz
cd Python-3.5.2
./configure --prefix=/usr/local/python3
make && make install

4. Set environment variables

echo 'export PATH=$PATH:/usr/local/python3/bin' >> ~/.bashrc

5. Set the directory

ln -sv /usr/local/python3/bin/python3.5 /usr/bin/python3

The purpose of this is to type python3 into any directory of the system and call the command python3.5

Install pip

pip is installed according to the official website wiki.

1. Install setuptools. Before installing pip, you need to install setuptools. The download address is given on the above page.

Download and execute:

wget --no-check-certificate
cd setuptools-5.7
python3 install

wget wget
tar xvf pip-7.1.2.tar.gz
cd pip-7.1.2
python3 install

Just finish loading it.


Related articles: