一般來說,使用國外的網站安裝軟體有些速度會很慢,是以在安裝軟體時可以使用國内的網站。
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,如需轉載請自行聯系原作者