天天看点

easy_install 和pip安装软件时使用指定的 源地址

    一般来说,使用国外的网站安装软件有些速度会很慢,因此在安装软件时可以使用国内的网站。

1、临时改变

    使用easy_install安装pip时有时就会很慢,因此可以更换软件源地址:

<code>easy_install -i https://mirrors.aliyun.com/pypi/simple pip</code>

    同时pip安装软件时也可以使用指定的源地址安装软件:

<code>pip install -i https://pypi.tuna.tsinghua.edu.cn/simple lxml</code>

2、永久改变

    也可以通过设置easy_install和pip的配置文件永久更换软件源地址:

    easy_install的配置文件 ~/.pydistutils.cfg  ,可以在其中添加如下内容:

<code>[easy_install]</code>

<code>index_url = https://pypi.tuna.tsinghua.edu.cn/simple</code>

    pip的配置文件 ~/.pip/pip.conf (可能需要创建.pip目录及pip.conf文件),在其中添加如下内容:

<code>[global]</code>

<code>index-url = https://pypi.tuna.tsinghua.edu.cn/simple</code>

<code></code>

本文转自 f_066 51CTO博客,原文链接:http://blog.51cto.com/ganmu/1956330,如需转载请自行联系原作者

继续阅读