加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

python pip使用豆瓣源技巧和pip配置文件更改豆瓣源

发布时间:2020-12-17 17:00:14 所属栏目:Python 来源:网络整理
导读:豆瓣镜像地址:https://pypi.douban.com/simple/ 虽然使用pip安装非常方便,但是由于不可描述原因,导致访问官方的pypi非常不稳定,安装模块经常出现timeout。 因此在国内强烈建议使用豆瓣源。 liunx使用豆瓣源 sudo?easy_install?-i?http://pypi.douban.com

豆瓣镜像地址:https://pypi.douban.com/simple/

虽然使用pip安装非常方便,但是由于不可描述原因,导致访问官方的pypi非常不稳定,安装模块经常出现timeout。

因此在国内强烈建议使用豆瓣源。

liunx使用豆瓣源

sudo?easy_install?-i?http://pypi.douban.com/simple/?ipython
sudo?pip?install?-i?http://pypi.douban.com/simple/?--trusted-host=pypi.douban.com/simple?ipython

通用命令

pip??install??-i??https://pypi.doubanio.com/simple/??--trusted-host?pypi.doubanio.com??django

liunx/mac把豆瓣源写入配置文件

linux下配置文件指定位置为

$HOME/.config/pip/pip.conf

或者

$HOME/.pip/pip.conf

mac下配置文件指定位置为


$HOME/Library/Application?Support/pip/pip.conf


或者

$HOME/.pip/pip.conf

内容如下:

[global]
timeout?=?60
index-url?=?https://pypi.doubanio.com/simple

Window把豆瓣源写入配置文件

配置文件路径

%APPDATA%pippip.ini

或者

%HOME%pippip.ini

内容如下:

[global]
timeout?=?60
index-url?=?http://pypi.douban.com/simple
trusted-host?=?pypi.douban.com

参考文章:http://www.cnblogs.com/ZhangRuoXu/p/6370107.html


(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读