您的位置:首页 > 编程语言 > Python开发

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

2014-03-31 21:35 1316 查看
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/ <your_env_name>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: