1. 程式人生 > >python3 安裝 pip3 (centos6.5)

python3 安裝 pip3 (centos6.5)

2018-08-25

首先系統自帶的python是python2

我們需要安裝一個python3 pip3

安裝python

1.安裝環境

# yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-develreadline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

2.下載包

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

3.解壓包

 tar -zxvf Python-3.6.1.tgz

4.建立安裝目錄,進入解壓後的包,制定安裝路徑進行安裝

mkir -p /usr/local/python3

cd Python-3.6.1

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

5.編譯安裝

make && make install

6.建立軟連線

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

這樣在命令列中輸入python代表python2,輸入python3代表python3

安裝pip3

1.首先安裝setuptools

 

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

tar -zxvf setuptools-19.6.tar.gz

cd setuptools-19.6.tar.gz

python3 setup.py build

python3 setup.py install

2.安裝pip3

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

tar -zxvf pip-8.0.2.tar.gz

cd pip-8.0.2

python3 setup.py build

python3 setup.py install

3.安裝完成之後我們再來看下python的bin目錄下都有什麼東西吧,發現有pip3

建立軟連線

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