Home >Operation and Maintenance >Linux Operation and Maintenance >How to install python environment in linux?

How to install python environment in linux?

藏色散人
藏色散人Original
2019-05-20 15:21:157182browse

How to install python environment in linux?

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!

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