码迷,mamicode.com
首页 > 编程语言 > 详细

python 使用国内源安装软件

时间:2018-03-02 20:41:49      阅读:1049      评论:0      收藏:0      [点我收藏+]

标签:index   tin   格式   users   AC   mirrors   tor   blog   需要   

python linux 等 使用国内源安装软件 速度更快 你值得拥有 !

 

豆瓣源: https://pypi.douban.com/simple/

阿里源: http://mirrors.aliyun.com/pypi/simple/

清华源:https://pypi.tuna.tsinghua.edu.cn/simple/

华中理工大学源 :http://pypi.hustunique.com/simple/
山东理工大学 :http://pypi.sdutlinux.org/simple/
中国科学技术大学:http://pypi.mirrors.ustc.edu.cn/simple/

1、使用 pip 安装软件(包):指定源

pip install -i 源 软件(或者包)

例如:pip install -i https://pypi.douban.com/simple pymysql

 2、一劳永逸的做法:

  •  linux下,

修改 ~/.pip/pip.conf (没有就创建一个), 修改 index-url至tuna,内容如下:

[global]
index
-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host=mirrors.aliyun.com
  •  windows 下

  在你的“C:\Users\你的用户名\”目录下创建“pip”目录,

“pip”目录下创建“pip.ini”文件(注意:以UTF-8 无BOM格式编码);
“pip.ini”文件内容:


[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host=mirrors.aliyun.com 

注意:trusted-host 选项为了避免麻烦是必须的,否则使用的时候会提示不受信任,
或者添加“--trusted-host=mirrors.aliyun.com”选项;

注意:有网页提示需要创建或修改配置文件
(linux的文件在~/.pip/pip.conf,windows在%HOMEPATH%\pip\pip.ini),
至少Windows7下“%HOMEPATH%\pip\pip.ini”这个目录是不起作用的。
  • pycharm 指定第三方源

点击File ---> Setting ---> Project Interpeter,

点击右边的?按钮弹出包管理界面 ,

选择下方的Manage Repositories按钮,

加入上面的镜像即可

技术分享图片

 源地址的后面可以有“/”,也可以没有“/”:

https://pypi.tuna.tsinghua.edu.cn/simple

https://pypi.tuna.tsinghua.edu.cn/simple/

 

python 使用国内源安装软件

标签:index   tin   格式   users   AC   mirrors   tor   blog   需要   

原文地址:https://www.cnblogs.com/zlsgh/p/8494435.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!