python 国内镜像加速
原因
经常在使用Python的时候需要安装各种模块,而pip是很强大的模块安装工具
但是由于国外官方默认pip访问速度慢,经常被墙,导致无法安装,所以我们最好是将自己使用的pip源更换一下,这样就能解决被墙导致的装不上库的烦恼
# 查看已经安装软件列表
$ pip freeze
# 查看当前配置
$ python -m site
USER_BASE和USER_SITE其实就是用户自定义的启用Python脚本和依赖安装包的基础路径
镜像列表
http://mirrors.aliyun.com/pypi/simple/ //阿里
https://pypi.tuna.tsinghua.edu.cn/simple/ //清华
http://pypi.douban.com/ //豆瓣
http://pypi.hustunique.com/ //华中理工大学
http://pypi.sdutlinux.org/ //山东理工大学
http://pypi.mirrors.ustc.edu.cn/ //中国科学技术大学
国内使用得比较多并且速度比较快的是阿里的pip源或者清华大学,清华大学的是官网pypi的镜像
临时使用
pip的时候加参数 -i
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple gevent
常驻使用
Linux or macOS
修改 ~/.pip/pip.conf (没有就自己创建), 增加或者修改 index-url 至源
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = pypi.tuna.tsinghua.edu.cn
disable-pip-version-check = true
- 豆瓣源使用
mkdir -p ~/.pip
echo -e '[global]\ntrusted-host = pypi.douban.com\nindex-url = http://pypi.douban.com/simple' > ~/.pip/pip.conf
windows
直接在user目录中创建一个pip目录,如:C:\Users\xx\pip
新建文件 pip.ini 内容
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = pypi.tuna.tsinghua.edu.cn
disable-pip-version-check = true
timeout = 120
或者使用豆瓣源
[global]
index-url = http://pypi.douban.com/simple
trusted-host = pypi.douban.com
disable-pip-version-check = true
timeout = 120
- index-url 源,可以换成其他的源
- trusted-host 添加源为可信主机,要不然可能报错
- disable-pip-version-check 设置为true取消pip版本检查,排除每次都报最新的pip
- timeout 超时设置
mkdir -p ~/.pip
echo -e '[global]\ntrusted-host = pypi.douban.com\nindex-url = http://pypi.douban.com/simple' > ~/.pip/pip.conf
windows
直接在user目录中创建一个pip目录,如:C:\Users\xx\pip
新建文件 pip.ini 内容
[global]
index-url = http://pypi.douban.com/simple
trusted-host = pypi.douban.com
disable-pip-version-check = true
timeout = 120
或者
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = pypi.tuna.tsinghua.edu.cn
disable-pip-version-check = true
timeout = 120
pip conf 参数说明
[install]安装参数install-option=--prefix=pip install的安装路径[global]表示为全局配置- index-url 源,可以换成其他的源
- trusted-host 添加源为可信主机,要不然可能报错
- disable-pip-version-check 设置为true取消pip版本检查,排除每次都报最新的pip
- timeout 超时设置
python 国内镜像加速的更多相关文章
- python 使用pip安装使用国内镜像加速下载安装包的方法
清华大学提供开源镜像站:https://mirrors.tuna.tsinghua.edu.cn/help/pypi/ pypi 镜像每 5 分钟同步一次. pip install 包的名字 == 版 ...
- pip安装库时报错,使用国内镜像加速
pip install requests或pip --trusted-host pypi.python.org install requests报错: 原因:网上解释为网速太慢,或被防火墙 解决方法: ...
- docker学习(2) mac中docker-machine使用vmware fusion以及配置国内镜像加速
一.前言 先回顾下上一节创建docker-machine的过程,默认情况下docker toolbox中的docker-machine使用virtual box创建虚拟机,KI首次启动时创建虚拟机的过 ...
- 安装使用yarn,使用国内镜像加速npm和yarn
安装yarn https://yarnpkg.com/lang/zh-hans/docs/install/ 使用国内镜像加速npm和yarn 1. npm config set registry=ht ...
- Python pip 下载速度慢? Windows 设置 国内源,用 阿里云 国内镜像 加速
pip 提供了对 Python 包的查找.下载.安装.卸载的功能,是非常方便的 Python 包管理工具.但是,令人苦恼的是 pip 在国内的下载速度非常慢,速度常常只有每秒几十 K,甚至才几 K,小 ...
- 使用国内镜像加速下载Android SDK
本文转自:http://blog.kuoruan.com/24.html.感谢原作者. 什么是Android SDK SDK:(software development kit)软件开发工具包.被软件 ...
- python国内镜像源
让python pip使用国内镜像 国内源: 清华:https://pypi.tuna.tsinghua.edu.cn/simple 阿里云:http://mirrors.aliyun.com/pyp ...
- Python 国内镜像源
让 python pip 使用国内镜像源 国内镜像源: 清华:https://pypi.tuna.tsinghua.edu.cn/simple 阿里云:http://mirrors.aliyun.co ...
- python 国内镜像
pipy国内镜像目前有: http://pypi.douban.com/ 豆瓣 http://pypi.hustunique.com/ 华中理工大学 http://pypi.sdutlinux.o ...
随机推荐
- Critical Links
UVA 796 Critical Links http://acm.hust.edu.cn/vjudge/contest/view.action?cid=82833#overview 题目大意:给你一 ...
- Redis集群的搭建【转】
redis集群的特点: 1.机器多,能够保证redis服务器出现问题后,影响较小 2.自备主从结构,自动的根据算法划分主从结构.动态的实现 3.能够根据主从结构自动的实现高可用 4.实现数据文件的备份 ...
- 【ERP知识】一个VMI(供应商管理库存)实现方案
VMI,Vendor Managed Inventory,供应商管理库存 是指客户不采购或尽量少采购物料,而是由供应商保证该物料有充足的数量,在客户需要的时候能按时提供. 这样可以降低客户方的库存成本 ...
- sql查询语句得到返回值fetchone()
需求: 现在mysql中有一张表,表名是info,我想通过报案号4201820330114401021497在这张表里查询出它对应的id. sql = "select claim_id fr ...
- [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause 的问题
问题: [Err] 1055 - Expression #1 of ORDER BY clause is not in GROUP BY clause and contains nonaggregat ...
- 阿里云二级域名解析指向服务器另一台主机— —Nginx
这是在一台阿里云服务器没有任何域名,但是配置高,因此想借用另一台阿里云服务器(配置较低)已备案的域名 跳转到这台配置高的服务器,那么使用nginx反向代理 server { listen 80; se ...
- 4.tensorflow——CNN
1.CNN结构:X-->CONV(relu)-->MAXPOOL-->CONV(relu)-->FC(relu)-->FC(softmax)-->Y 1.1 卷积层 ...
- 判断是否是NaN
if (isNaN(parseInt(x))) { alert("非数字"); } else{ alert("数字"); }
- md5加密报错解决方法(TypeError: Unicode-objects must be encoded before hashing)
update()必须指定要加密的字符串的字符编码
- UVA12589_Learning Vector
大致题意: 有n个向量要你选k个,把这k个向量连起来,画出来的与x轴围成的面积最大 思路: 这个是斜率dp,让斜率大的排在前面,记忆化搜索的时候要加入一个当前高的信息,因为这个向量形成面积不仅和斜率有 ...