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>
相关文章
相关标签/搜索