Ubuntu 下 python 安装pip


背景

python的强大在于它的第三方库。

安装

python2

sudo apt-get install python-pip

python3

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py

更换源

为了加快pip install的速度。

源列表:

# 豆瓣
https://pypi.doubanio.com/simple/
# 阿里云    
https://mirrors.aliyun.com/pypi/simple/
# 清华大学
https://pypi.tuna.tsinghua.edu.cn/simple/
https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/

临时做法:
通过-i 指定使用某个源

pip install some-package -i https://mirrors.aliyun.com/pypi/simple/

永久固化到配置项

mkdir  ~/.pip/ -p
echo "[global]\nindex-url = https://pypi.tuna.tsinghua.edu.cn/simple" > ~/.pip/pip.conf 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM