在使用python中,我们需要用到很多非python自带的库,这时候,我们就需要使用pip install 安装对应的库,本文记录一下自己的常用方法,供大家学习交流。
1, win + r 打开运行窗口,输入cmd 
2,输入pip install 你要安装的库的名字 -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple some-package(这是清华源)
例如:安装furl库,一个简单易用的URL处理库,用于构建和解析URL。
pip install furl -i https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple some-package


安装成功见上图所示,Successfully installed furl-2.1.3 orderedmultidict-1.0.1
3,通过输入pip show 查看安装过的库,再次确认是否安装成功以及详细信息(依赖、主页、本地路径)
pip show furl

4,如果经常要安装库的话,建议将清华源设为默认源
python -m pip config set global.index-url https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple
其他镜像网站可以点击下面的链接进行查看
pypi | 镜像站使用帮助 | 清华大学开源软件镜像站 | Tsinghua Open Source Mirror
如果公司/学校有私有源,想临时换回官方源则:
pip install -i https://pypi.org/simple/ 某个包
5,卸载指定的包(如furl)
python -m pip uninstall -y furl
30万+

被折叠的 条评论
为什么被折叠?



