Mac如何快速安装pip3(macos安装pip)
文章标签:
bootstrap 3教程
1、背景
现在最新的mac已经不预装python2.7了,需要自己手动安装python3(详见我另一篇文章Mac安装python3)。装好python3后才可以安装pip,而且最好把pip的镜像源设置为国内的源,因为国外的速度太慢了。
2、安装方法
打开‘终端’,输入以下两行:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
sudo python3 get-pip.py
安装完后,最好把镜像源设置为国内的,这样用pip安装其他包的速度会超快:
pip3 config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
3、升级方法
使用国内清华大学的源进行升级
python3 -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple --upgrade pip
4、使用方法
安装完pip,就可以使用pip来安装和卸载各类包了
安装某个包(xxx为要替换的包名)
sudo pip3 install xxx
卸载某个包(xxx为要替换的包名)
sudo pip3 uninstall xxx
升级某个包至最新版本(xxx为要替换的包名)
sudo pip3 install --upgrade xxx
查看已经安装的包
sudo pip3 list