创建venv时命令提示符冻结

时间:2017-08-31 13:01:07

标签: python django windows

我正在开始一个新的django项目,当我尝试将一个venv添加到项目文件夹时,我的命令提示符冻结在以下代码的最后一行:

C:\Users\ab\workspace\rc>virtualenv venv
Using base prefix 'c:\\users\\ab\\appdata\\local\\programs\\python\\python36-32'
New python executable in C:\Users\ab\workspace\rc\venv\Scripts\python.exe
Installing setuptools, pip, wheel...

当我尝试在我的PyCharm项目中使用命令提示符安装它时也一样。

当我控制-C时,我看到以下内容:

    Traceback (most recent call last):
      File "c:\users\ab\appdata\local\programs\python\python36-32\lib\runpy.py", line 193, in _run_module_as_main
        "__main__", mod_spec)
      File "c:\users\ab\appdata\local\programs\python\python36-32\lib\runpy.py", line 85, in _run_code
        exec(code, run_globals)
      File "C:\Users\ab\AppData\Local\Programs\Python\Python36-32\Scripts\virtualenv.exe\__main__.py", line 9, in <module>
      File "c:\users\ab\appdata\local\programs\python\python36-32\lib\site-packages\virtualenv.py", line 713, in main
        symlink=options.symlink)
      File "c:\users\ab\appdata\local\programs\python\python36-32\lib\site-packages\virtualenv.py", line 945, in create_environment
        download=download,
      File "c:\users\ab\appdata\local\programs\python\python36-32\lib\site-packages\virtualenv.py", line 901, in install_wheel
        call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
      File "c:\users\ab\appdata\local\programs\python\python36-32\lib\site-packages\virtualenv.py", line 786, in call_subprocess
        logger.info(line)
      File "c:\users\ab\appdata\local\programs\python\python36-32\lib\site-packages\virtualenv.py", line 198, in info
        self.log(self.INFO, msg, *args, **kw)
      File "c:\users\ab\appdata\local\programs\python\python36-32\lib\site-packages\virtualenv.py", line 220, in log
        if self.level_matches(level, consumer_level):
    KeyboardInterrupt

当我尝试vitrualenv venv -v时,我得到:

Creating C:\Users\ab\Desktop\venv\Lib
Symlinking Python bootstrap modules
  Copying to C:\Users\ab\Desktop\venv\lib\os.py
  Cannot import bootstrap module: posix
  Copying to C:\Users\ab\Desktop\venv\lib\posixpath.py
  Ignoring built-in bootstrap module: nt
  Copying to C:\Users\ab\Desktop\venv\lib\ntpath.py
  Copying to C:\Users\ab\Desktop\venv\lib\genericpath.py
  Copying to C:\Users\ab\Desktop\venv\lib\fnmatch.py
  Copying to C:\Users\ab\Desktop\venv\lib\locale.py
  Copying to C:\Users\ab\Desktop\venv\lib\encodings
  Copying to C:\Users\ab\Desktop\venv\lib\codecs.py
  Copying to C:\Users\ab\Desktop\venv\lib\stat.py
  Cannot import bootstrap module: UserDict
  Cannot import bootstrap module: readline
  Cannot import bootstrap module: copy_reg
  Copying to C:\Users\ab\Desktop\venv\lib\types.py
  Copying to C:\Users\ab\Desktop\venv\lib\re.py
  Cannot import bootstrap module: sre
  Copying to C:\Users\ab\Desktop\venv\lib\sre_parse.py
  Copying to C:\Users\ab\Desktop\venv\lib\sre_constants.py
  Copying to C:\Users\ab\Desktop\venv\lib\sre_compile.py
  Ignoring built-in bootstrap module: zlib
  Cannot import bootstrap module: _abcoll
  Copying to C:\Users\ab\Desktop\venv\lib\warnings.py
  Copying to C:\Users\ab\Desktop\venv\lib\linecache.py
  Copying to C:\Users\ab\Desktop\venv\lib\abc.py
  Copying to C:\Users\ab\Desktop\venv\lib\io.py
  Copying to C:\Users\ab\Desktop\venv\lib\_weakrefset.py
  Copying to C:\Users\ab\Desktop\venv\lib\copyreg.py
  Copying to C:\Users\ab\Desktop\venv\lib\tempfile.py
  Copying to C:\Users\ab\Desktop\venv\lib\random.py
  Copying to C:\Users\ab\Desktop\venv\lib\__future__.py
  Copying to C:\Users\ab\Desktop\venv\lib\collections
  Copying to C:\Users\ab\Desktop\venv\lib\keyword.py
  Copying to C:\Users\ab\Desktop\venv\lib\tarfile.py
  Copying to C:\Users\ab\Desktop\venv\lib\shutil.py
  Copying to C:\Users\ab\Desktop\venv\lib\struct.py
  Copying to C:\Users\ab\Desktop\venv\lib\copy.py
  Copying to C:\Users\ab\Desktop\venv\lib\tokenize.py
  Copying to C:\Users\ab\Desktop\venv\lib\token.py
  Copying to C:\Users\ab\Desktop\venv\lib\functools.py
  Copying to C:\Users\ab\Desktop\venv\lib\heapq.py
  Copying to C:\Users\ab\Desktop\venv\lib\bisect.py
  Copying to C:\Users\ab\Desktop\venv\lib\weakref.py
  Copying to C:\Users\ab\Desktop\venv\lib\reprlib.py
  Copying to C:\Users\ab\Desktop\venv\lib\base64.py
  Copying to C:\Users\ab\Desktop\venv\lib\_dummy_thread.py
  Copying to C:\Users\ab\Desktop\venv\lib\hashlib.py
  Copying to C:\Users\ab\Desktop\venv\lib\hmac.py
  Copying to C:\Users\ab\Desktop\venv\lib\imp.py
  Copying to C:\Users\ab\Desktop\venv\lib\importlib
  Copying to C:\Users\ab\Desktop\venv\lib\rlcompleter.py
  Copying to C:\Users\ab\Desktop\venv\lib\operator.py
  Copying to C:\Users\ab\Desktop\venv\lib\_collections_abc.py
  Copying to C:\Users\ab\Desktop\venv\lib\_bootlocale.py
  Copying to C:\Users\ab\Desktop\venv\lib\enum.py
Creating C:\Users\ab\Desktop\venv\Lib\site-packages
Writing C:\Users\ab\Desktop\venv\lib\site.py
Writing C:\Users\ab\Desktop\venv\lib\orig-prefix.txt
Writing C:\Users\ab\Desktop\venv\lib\no-global-site-packages.txt
Copying to C:\Users\ab\Desktop\venv\Include
Creating C:\Users\ab\Desktop\venv\Scripts
New python executable in C:\Users\ab\Desktop\venv\Scripts\python.exe
Changed mode of C:\Users\ab\Desktop\venv\Scripts\python.exe to 0o777
Also created pythonw.exe
Also created python36.dll
Testing executable with C:\Users\ab\Desktop\venv\Scripts\python.exe -c "import sys;out=sys.stdout;getattr(out, "buffer", out).write(sys.prefix.encode("utf-8"))"
Got sys.prefix result: 'c:\\users\\ab\\desktop\\venv'
Creating C:\Users\ab\Desktop\venv\lib\distutils
Writing C:\Users\ab\Desktop\venv\lib\distutils\__init__.py
Writing C:\Users\ab\Desktop\venv\lib\distutils\distutils.cfg
Installing setuptools, pip, wheel...
  Collecting setuptools

我在Windows 7上。知道是什么阻止了它吗?

1 个答案:

答案 0 :(得分:0)

你正在做正确的事。要创建虚拟环境,请使用以下命令: -

  

virtualenv venv

您需要等待几分钟才能创建虚拟环境。这将需要一两分钟。创建虚拟环境后,您需要使用以下命令激活它:

  

。 VENV / bin中/激活

创建时不要按Ctrl + c。它将终止进度。 如果需要,请访问以下链接。

http://www.swegler.com/becky/blog/2011/08/28/python-django-mysql-on-windows-7-part-2-virtual-environments/