Python pip 国内镜像大全及使用办法

Python pip 国内镜像大全及使用办法

一、国内镜像

清华
https://pypi.tuna.tsinghua.edu.cn/simple
豆瓣
pip install -i http://pypi.douban.com/simple --trusted-host pypi.douban.com '模块版本'
阿里云
pip install -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com '模块版本'
中国科学技术大学
pip install -i http://pypi.mirrors.ustc.edu.cn/simple/ --trusted-host pypi.mirrors.ustc.edu.cn '模块版本'
华中理工大学
pip install -i http://pypi.hustunique.com/simple/ --trusted-host pypi.hustunique.com '模块版本'
山东理工大学
pip install -i http://pypi.sdutlinux.org/simple/ --trusted-host pypi.sdutlinux.org '模块==版本'

二、使用办法

特殊情况

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl
.c:1124)'))': /simple/xlwt/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl
.c:1124)'))': /simple/xlwt/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl
.c:1124)'))': /simple/xlwt/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl
.c:1124)'))': /simple/xlwt/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl
.c:1124)'))': /simple/xlwt/

在安装过程我还遇到类似如下的错误
在这里插入图片描述
解决方案

pip install -i http://pypi.douban.com/simple --trusted-host pypi.douban.com selenium==4.3.0
python.exe -m pip install --upgrade pip
# pip install Bio -i https://pypi.douban.com/simple/
pip install Bio -i http://pypi.douban.com/simple --trusted-host pypi.douban.com 
1、临时使用,添加“-i”或“–index”参数
pip install django==1.11.25 -i https://pypi.douban.com/simple/

例如升级pip

python -m pip install --upgrade pip -i https://pypi.douban.com/simple/
2、配制成默认的

在你的“C:\Users\你的用户名\”目录下创建“pip”目录,“pip”目录下创建“pip.ini”文件(注意:以UTF-8 无BOM格式编码);
“pip.ini”文件内容:

[global]
index-url=http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host=mirrors.aliyun.com
3、注意:

1、trusted-host 选项为了避免麻烦是必须的,否则使用的时候会提示不受信任,或者添加“–trusted-host=mirrors.aliyun.com”选项;
2、有网页提示需要创建或修改配置文件(linux的文件在~/.pip/pip.conf,windows在%HOMEPATH%\pip\pip.ini),至少Windows7下“%HOMEPATH%\pip\pip.ini”这个目录是不起作用的。

三、在线下载模块离线安装包以及依赖包

# 在线下载离线安装包以及依赖
pip download 你的包名 -d "下载的路径(windows下双引号来表示文件夹)"

# 离线自动安装安装包以及依赖
conda create -n CasRel python=3.6.5
pip install -r requirements.txt --no-index --find-links=./pip_pkgs

四、python中pip 安装、升级、升级固定的包

1、pip下载安装
下载 进入https://pypi.python.org/pypi/pip,下载 .tar.gz压缩包

2、Linux 安装pip

tar -xzvf pip-1.5.4.tar.gz      解压
cd pip-1.5.4                    进入解压文件
python setup.py install         安装

3、升级pip

python -m pip install --upgrade pip
python -m pip install --upgrade pip -i https://pypi.douban.com/simple/

4、pip使用p安装包详解

pip install 安装包名

  [...]
Successfully installed 包名    #安装成功
2.3 pip检查哪些包需要更新

5、查看安装的包

pip list

6、 pip升级包

pip install --upgrade 要升级的包名

  包名  目前安装的版本号    最新版本号

7、 pip卸载包

pip uninstall 要卸载的包名
  • 6
    点赞
  • 44
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

xiongsheng666

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值