Linux install Python, PIP

The first step, download Python3

Enter the download command: wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz

The second step, decompression

Before performing the decompression decompression create a directory:

mkdir -p /usr/local/python3

The third step is to compile and install

First enter the unzipped directory:

cd Python-3.6.1

Then configure the look installation directory, installed into a directory that we created before / usr / local / python3, the benefits of doing so is that next time you want to uninstall the software can be uninstalled directly under that directory:

./configure --prefix=/usr/local/python3

Then compile it:

make

Last is installed:

make install

The fourth step, the establishment of soft link

Linux soft link in fact equivalent shortcuts in Windows:

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

The fifth step, the / usr / local / python3 / bin join the PATH environment variable

# vim ~/.bash_profile

Vim into the edit page, and enter the instruction i added the following:

export PATH=$PATH:$HOME/bin:/usr/local/python3/bin

Then press the [ESC] to exit the editor, enter: wq command and press enter to save and exit. (If you are unsure whether to save, you can enter the command again vim ~ / .bash_profile just to see if the content has been successfully saved, if successfully enter the direct command:. Q Enter Exit)

The sixth step, to test whether the installation is successful

python3 -V

Installation PIP

Python is a big advantage is its huge library of third-party support, and to use these libraries, they can not be separated Python package management tool pip, so let's now download a.

Before installing pip install setuptools

Download setuptools:

wget --no-check-certificate  https://pypi.python.org/packages/source/s/setuptools/setuptools-19.6.tar.gz#md5=c607dd118eae682c44ed146367a17e26

Decompression:

tar -zxvf setuptools-19.6.tar.gz

Enter to extract the disk:

cd setuptools-19.6

Compile:

python3 setup.py build

installation:

python3 setup.py install

Error Resolution:

RuntimeError: Compression requires the (missing) zlib module

Description missing zlib and zlib-devel package
solution:

install zlib zlib-devel yum - the y-
 # then: Go to the next source package python's installation directory (this step is very important) I was python33.6 version 
cd /home/tools/python33.6 
the make # recompile 
the make install # re install it 
# then: go to the next setuptool source directory to be installed: 
python33 setup.py install 
 # use python33.6 install a new installation, do not use the system comes with python installation.

Installation pip

download

wget --no-check-certificate  https://pypi.python.org/packages/source/p/pip/pip-8.0.2.tar.gz#md5=3a73c4188f8dbad6a1e6f6d44d117eeb

Decompression:

tar -zxvf pip-8.0.2.tar.gz

Enter to extract the disk:

cd pip-8.0.2

Compile:

python3 setup.py build

installation:

python3 setup.py install

 

Guess you like

Origin www.cnblogs.com/yinluhei/p/11306566.html
Recommended