python 使用国内源安装软件,python国内,python lin


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 ---> ProjectInterpeter,

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

选择下方的ManageRepositories按钮,

加入上面的镜像即可

技术分享图片

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

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

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

python 使用国内源安装软件

评论关闭