How to install python environment in linux?

藏色散人
Release: 2019-05-22 09:54:18
Original
7076 people have browsed it

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
Copy after login

2. Download the Python3.5 code package

wget https://www.python.org/ftp/python/3.5.0/Python-3.5.0.tar.xz
Copy after login

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
Copy after login

Make a soft link:

ln -s /usr/local/python3/bin/python3.5 /usr/local/bin/python3
Copy after login

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
Copy after login

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
Copy after login

Upgrade pip to the latest version:

pip install --upgrade pip
Copy after login

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
Copy after login

pyquery package:

pip install pyquery
Copy after login

pymysql package:

pip install pymysql
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!