Home >Backend Development >Python Tutorial >Install Python 3.5.2 under CentOS 6.5

Install Python 3.5.2 under CentOS 6.5

不言
不言Original
2018-05-05 15:33:041419browse

This article mainly introduces you to the method tutorial of installing Python 3.5.2 under CentOS 6.5. After installation, python3 and Python2 coexist. The article shares the detailed method steps, which has certain reference and learning value for everyone. The following Let’s take a look together.

This article mainly introduces to you the relevant content about installing Python 3.5.2 and coexisting with Python2 on CentOS 6.5. It is shared for your reference and study. Let’s take a look at the detailed introduction:

The installation steps are as follows

1. Prepare the compilation environment (if the environment is wrong, you may encounter various problems, such as wget being unable to download https link files)


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


2. Download the Python3.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 set the directory anywhere in the system Type python3 in the directory to call the python3.5 command

Install pip

pip is installed according to the official website wiki.

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

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 install it.

Related recommendations:

Tutorial on installing Python under Windows

How to install python under linux6.5 version

Detailed explanation of the process of installing python3 under Linux


The above is the detailed content of Install Python 3.5.2 under CentOS 6.5. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn