1. Install python3 under Linux
a. 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.0/Python-3.5.0.tar.xz
There is a README file in the installation package, which contains instructions on how to install
tar Jxvf Python-3.5.0.tar.xz cd Python-3.5.0./configure --prefix=/usr/local/python3 make && make install
Make a soft link:
ln -s /usr/local/python3/bin/python3.5 /usr/local/bin/python3
The installation was successful!
If it prompts:Ignoring ensurepip failure: pip 7.1.2 requires SSL/TLS
This is because oenssl is not installed or upgraded:
yum install openssl-devel
Repeat the compilation plan python3.5 again:
The final result is as follows:
Prompt that pip-7.12 and setuptools were successfully installed at the same time!
Both pip3 and pip prompt no errors!
Make a soft link:
ln -s /usr/local/python3/bin/pip3.5 /usr/local/bin/pip
Upgrade pip to the latest version:
pip install --upgrade pip
pip installation is successful!
Note: --no-check-certificate means "do not check the certificate" during installation. If not added, the installation may not be possible.
2. Installation package
requests package:
pip install requests
pyquery package:
pip install pyquery
pymysql package:
pip install pymysql
The above is the detailed content of How to install python environment in linux?. For more information, please follow other related articles on the PHP Chinese website!