virtualenv 挂断了安装 setuptools [英] virtualenv hung up on installing setuptools

查看:43
本文介绍了virtualenv 挂断了安装 setuptools的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

直到最近才遇到这个问题,但是在尝试创建新的虚拟环境(Windows 7、python 2.7.13、virtualenv==15.1.0)时,它只是挂在正在安装 setuptools、pip、wheel..." 并且做一个 crtl^c 给你这个:

never had this issue until just recently, but when trying to create a new virtual environment (windows 7, python 2.7.13, virtualenv==15.1.0) it just hangs on "Installing setuptools, pip, wheel..." and doing a crtl^c gives you this:

PS C:\Users\John\Envs> virtualenv.exe rmapvenv
New python executable in C:\Users\John\Envs\test\Scripts\python.exe
Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
  File "c:\python27\lib\runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "c:\python27\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\Python27\Scripts\virtualenv.exe\__main__.py", line 9, in <module>
  File "c:\python27\lib\site-packages\virtualenv.py", line 713, in main
    symlink=options.symlink)
  File "c:\python27\lib\site-packages\virtualenv.py", line 945, in create_environment
    download=download,
  File "c:\python27\lib\site-packages\virtualenv.py", line 901, in install_wheel
    call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
  File "c:\python27\lib\site-packages\virtualenv.py", line 769, in call_subprocess
    line = stdout.readline()
KeyboardInterrupt

在 virtualenv.py 中添加一些打印语句给了我这个:

adding some print statements in virtualenv.py gives me this:

Running command C:\Users\John\Envs\test\Scripts\python.exe - setuptools pip wheel

Collecting setuptools

  Using cached setuptools-35.0.1-py2.py3-none-any.whl

Collecting pip

Collecting wheel

好像挂在轮子上

推荐答案

使用 -v 开关获得 Verbose 输出.

Use the -v switch to get Verbose output.

对我来说,这是一个网络连接.具体来说,我试图在其上使用 virtualenv 的服务器被 Internet 防火墙屏蔽,我需要通过代理退出.除此之外,virtualenv 似乎不支持环境中的代理设置,并且它没有命令行开关.

For me, it was a network connection. Specifically, the server I was trying to use virtualenv on was firewalled from the Internet and I needed to get out thru a proxy. Except, that virtualenv doesn't seem to honor the proxy settings in the environment and it has no commandline switch.

所以使用 pip 来预缓存/预下载 3 个需要的包:

So use pip to pre-cache/pre-download the 3 needed packages:

sudo pip 下载 setuptools pip wheel --proxy http://

然后你可以运行virtualenv,它会使用你刚刚下载的缓存包.

Then you can run virtualenv and it will use the cached packages that you just downloaded.

这篇关于virtualenv 挂断了安装 setuptools的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆