Python virtualenv 使用國內pip/easy_install建立虛擬環境

Virtualenv Docs html

在使用Virtualenv建立虛擬開發環境時,常常由於網絡緣由,在安裝Installing setuptools…… 和 Installing pip…… 時等待超時。 python

爲解決此問題須要配置pip/easy_install國內pypi鏡像。 shell


pip Docs 網絡

    pip 配置文件中添加(不存在則建立) url

        On Unix and Mac OS X the configuration file is:  $HOME/.pip/pip.conf  spa

            On Windows, the configuration file is:  %HOME%\pip\pip.ini code

[global]
find-links=http://pypi.douban.com/simple
[instal]
find-links=
    http://pypi.douban.com/simple
    http://pypi.v2ex.com/simple


easy_install Docs htm

    easy_install 配置文件中添加(不存在則建立)    ip

            On Unix and Mac OS X the configuration file is:  $HOME/.pydistutils.cfg  開發

            On Windows, the configuration file is:  %HOME%\pydistutils.cfg

[easy_install]
index-url=http://pypi.douban.com/simple
find-links=
    http://pypi.douban.com/simple
    http://pypi.v2ex.com/simple


最後在運行virtualenv時加入 --extra-search-dir=SEARCH_PATH 選項,能夠搜索本地site-package,加速setuptools安裝。   

python virtualenv.py --extra-search-dir=/User/my/local/site-package/ <your_env_name>
相關文章
相關標籤/搜索