赞
踩
1
2
# cd Python-3.6.1
# ./configure --prefix=/usr/local/python3
建立python3的软链
1
# ln -s /usr/local/python3/bin/python3 /usr/bin/python3
并将/usr/local/python3/bin加入PATH
按ESC,输入:wq回车退出。
修改完记得执行行下面的命令,让上一步的修改生效:
1
# source /etc/profile
检查Python3及pip3是否正常可用:
1
2
3
4
# python3 -V
Python
3.6
.
1
# pip3 -V
pip
9.0
.
1
from
/
usr
/
local
/
python3
/
lib
/
python3.
6
/
site
-
packages (python
3.6
)
不行的话在创建一下pip3的软链接(我也不清楚这一步有什么用)
1
# ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3
2、安装pip以及setuptools
丰富的第三方库是python的优势所在,所以需要安装pip命令,方便安装第三方库。
安装pip前需要前置安装setuptools
命令如下:
tar -zxvf setuptools-19.6.tar.gz
cd setuptools-19.6
python3 setup.py build
python3 setup.py install
安装pip,默认自带了pip2
针对pip2的升级操作:
pipinstall--upgradepip
针对pip3的升级操作:
pip3 install --upgrade pip
[root@1st] /data0/laobanang/olmeca$ pip3 install --upgrade pip
Collecting pip
Downloading http://mirrors.tencentyun.com/pypi/packages/62/a1/0d452b6901b0157a0134fd27ba89bf95a857fbda64ba52e1ca2cf61d8412/pip-10.0.0-py2.py3-none-any.whl (1.3MB)
100% |████████████████████████████████| 1.3MB 50.1MB/s
Installing collected packages: pip
Found existing installation: pip 8.0.2
Uninstalling pip-8.0.2:
Successfully uninstalled pip-8.0.2
Successfully installed pip-9.0.1
You are using pip version 9.0.1, however version 10.0.0 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
[root@1st] /data0/laobanang/olmeca$ pip3 install --upgrade pip
Looking in indexes: http://mirrors.tencentyun.com/pypi/simple
Requirement already up-to-date: pip in /usr/local/python3/lib/python3.6/site-packages (10.0.0)
[root@1st] /data0/laobanang/olmeca$
PS:记录以前的操作命令
tar -zxvf pip-8.0.2.tar.gz
cd pip-8.0.2
python3 setup.py build
python3 setup.py install
如果没有意外的话,pip安装完成。
文章参考:https://www.cnblogs.com/kimyeee/p/7250560.html
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。