PIP安装库
pip安装库
pip install tensorflow
pip安装指定版本的库
pip install tensorflow==1.15.0
PIP参数
pip通过镜像安装(-i)
pip install tensorflow==1.15.0 -i https://mirrors.aliyun.com/pypi/simple
pip install tensorflow-io==1.15.0 -i https://pypi.tuna.tsinghua.edu.cn/simple --trusted-host pypi.tuna.tsinghua.edu.cn
pip通过文件安装(-r)
pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple
示例requirements.txt
(可以带版本号):
requests
sqlalchemy==1.3.20
peewee
tensorflow==1.15.0
PIP更新
更新
python -m pip install --upgrade pip -i https://pypi.tuna.tsinghua.edu.cn/simple
更新到指定版本
python -m pip install --upgrade pip==20.3.2 -i https://pypi.tuna.tsinghua.edu.cn/simple
PIP设置(镜像源设置)
设置
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
取消设置
pip config unset global.index-url
查看设置列表
pip config list
源 | 地址 |
---|---|
腾讯 | http://mirrors.tencentyun.com/pypi/simple |
阿里 | https://mirrors.aliyun.com/pypi/simple |
豆瓣 | https://pypi.douban.com/simple |
中科大 | https://pypi.mirrors.ustc.edu.cn/simple/ |
清华 | https://pypi.tuna.tsinghua.edu.cn/simple |
查看版本
pip库列表
pip list
pip看看库信息
pip show <库名>
常见问题
报错:This is an issue with the package mentioned above, not pip.
可以尝试降低库版本