FAQ: Linux Installation Python3 steps, Windows cannot take advantage of PIP

Source: Internet
Author: User

steps for Linux to install python3.6 and third-party libraries:

My Linux is the CentOS 6.5 version

Linux most of the system default comes with python2.x version, the most common is python2.6 or python2.7, the default Python is a lot of system programs rely on, such as the CentOS under the Python2 write, so do not delete the default version, if you need to use the latest PY Thon3 we can compile and install the source package to a standalone directory, which is not affected by the system default environment, Python3 and python2 two environments coexist can

First, install python3.6:

1. Get Administrator privileges:

Su-root

2. Preparing the compilation environment

# Yum Groupinstall ' development Tools '
# yum-y Install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel DB4 -devel Libpcap-devel Xz-devel

3. Download Python3

https://www.python.org/downloads/

# wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz

4. Installing Python3

I personally used to install in/usr/local/python3 (specific installation location to see a person's preferences)
Create a Directory

# mkdir-p/usr/local/python3

Unzip the downloaded PYTHON-3.X.X.TGZ package (the specific package name is not different for the specific version of Python you downloaded?) and not different, such as: I downloaded the Python3.6.1. Then I'm python-3.6.1.tgz.

# TAR-ZXVF python-3.6.1.tgz

5. Enter the extracted directory and compile the installation.

# CD Python-3.6.1 # ./configure--prefix=/usr/local/python3

Make and make install

# Make && make install

6. Build Python3 's soft chain

# ln-s/usr/local/python3/bin/python3/usr/bin/python3

7. Check if Python3 and PIP3 are normally available:

# python3-v Python 3.6.1#  pip3-v from/usr/local/python3/lib/python3.6/site-packages (python 3.6)

8. If you can't, then create a soft link to pip3.

# ln-s/USR/LOCAL/PYTHON3/BIN/PIP3/USR/BIN/PIP3

Second, the installation of Pip and Setuptools

1. Pre-installation Setuptools required before PIP installation

The command is as follows:

wget--no-check-certificate  https://pypi.python.org/packages/source/s/setuptools/setuptools-19.6.tar.gz  #md5=c607dd118eae682c44ed146367a17e26-zxvf setuptools-19.6. TAR.GZCD setuptools- 19.6python3 setup.py buildpython3 setup.py Install

2. Install Pip

The command is as follows:

wget--no-check-certificate  https://pypi.python.org/packages/source/p/pip/pip-8.0.2.tar.gz#MD5 =3a73c4188f8dbad6a1e6f6d44d117eeb-zxvf pip-8.0.2. TAR.GZCD pip-8.0.2python3 setup.py Buildpython3 setup.py Install

If there is no accident, PIP installation is complete.

The above content reference link: https://www.cnblogs.com/kimyeee/p/7250560.html

issues that Windows PIP cannot use

My win8 system in cmd enter pip install xxx always prompt "Pip is not an internal command or external command ..." ;

This problem occurs because PIP ' is not recognized as a internal or external command operable program or batch file (results from Google search)

If you have already installed Pip, the workaround is to add the PIP to the environment variable (as if you had added python to the environment variable)

Then went to see, Site-packages Pip and Pip-9.0.1-py3.6.egg, there is no pip.py or pip.exe, so the path can not be added to the path (environment variable), so there is no way to run PIP

Solution One:

(Image source: https://stackoverflow.com/questions/12878615/python-pip-command-is-not-recognized)

The general meaning of the picture is: open cmd as an administrator, and switch the path to the Python installation directory (for example, my: D:\python), a subfolder under the Python folder called "Scripts", and then switch the path to this "Scripts", This path has "Pip.exe", as shown below:

So when you want to use PIP, you can switch the path to python\scripts in cmd (admin) and enter the PIP install third-party module name

Workaround Two:

Of course, you can also add this path to the environment variable (path) so that you can enter "Pip install xx" in CMD later (just as you would enter "Python" in cmd to start a python program)

Add the environment variable as shown:

Once added, you can use Pip directly in cmd

Reference Link: 51914914

FAQ: Linux Installation Python3 steps, Windows cannot take advantage of PIP

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.