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
wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tar.xz
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 https://pypi.python.org/packages/source/s/setuptools/setuptools-5.7.zip --no-check-certificate
unzip setuptools-5.7.zip
cd setuptools-5.7
python3 setup.py install
wget wget https://pypi.python.org/packages/source/p/pip/pip-7.1.2.tar.gz#md5=3823d2343d9f3aaab21cf9c917710196
tar xvf pip-7.1.2.tar.gz
cd pip-7.1.2
python3 setup.py install
Just finish loading it.
conclusion