Python virtualenv 使用国内pip/easy_install创建虚拟环境

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

Virtualenv Docs

在使用Virtualenv创建虚拟开发环境时,经常因为网络原因,在安装Installing setuptools…… 和 Installing pip…… 时等待超时。

为解决此问题需要配置pip/easy_install国内pypi镜像。


pip Docs

    pip 配置文件中添加(不存在则创建)

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

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

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


easy_install Docs

    easy_install 配置文件中添加(不存在则创建)   

            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/ 



转载于:https://my.oschina.net/dexterman/blog/214896

你可能感兴趣的:(Python virtualenv 使用国内pip/easy_install创建虚拟环境)