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 
posted @ 2020-05-29 09:35  schips  阅读(1510)  评论(0编辑  收藏  举报