使用python 3创建虚拟环境时如何修复看似无限的循环?

dil*_*ess 4 python virtualenv

Cmd 提示说virtualenv with interpreter c:\users\di203179\appdata\local\programs\python\python37-32\python.exe重复运行并且从不创建虚拟环境。

我试过升级 pip 和 python,并运行命令的变体 virtualenv mypython

virtualenv mypython

我希望创建一个名称跟随命令的文件夹virtualenv

但实际结果是这样的:

Running virtualenv with interpreter c:\users\di203179\appdata\local\programs\python\python37-32\python.exe
Running virtualenv with interpreter c:\users\di203179\appdata\local\programs\python\python37-32\python.exe
Running virtualenv with interpreter c:\users\di203179\appdata\local\programs\python\python37-32\python.exe
Running virtualenv with interpreter c:\users\di203179\appdata\local\programs\python\python37-32\python.exe
Running virtualenv with interpreter c:\users\di203179\appdata\local\programs\python\python37-32\python.exe
Running virtualenv with interpreter c:\users\di203179\appdata\local\programs\python\python37-32\python.exe
Running virtualenv with interpreter c:\users\di203179\appdata\local\programs\python\python37-32\python.exe
Run Code Online (Sandbox Code Playgroud)

直到我点击ctrl-c它给出了这个:

Traceback (most recent call last):
  File "c:\users\di203179\appdata\local\programs\python\python37-32\lib\site-packages\virtualenv.py", line 19, in <module>
    import base64
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 963, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 906, in _find_spec
  File "<frozen importlib._bootstrap_external>", line 1280, in find_spec
  File "<frozen importlib._bootstrap_external>", line 1252, in _get_spec
  File "<frozen importlib._bootstrap_external>", line 1364, in find_spec
  File "<frozen importlib._bootstrap_external>", line 81, in _path_stat
KeyboardInterrupt
Traceback (most recent call last):
  File "c:\users\di203179\appdata\local\programs\python\python37-32\lib\site-packages\virtualenv.py", line 2611, in <module>
    main()
  File "c:\users\di203179\appdata\local\programs\python\python37-32\lib\site-packages\virtualenv.py", line 815, in main
    raise SystemExit(sub_process_call.wait())
  File "c:\users\di203179\appdata\local\programs\python\python37-32\lib\subprocess.py", line 990, in wait
    return self._wait(timeout=timeout)
  File "c:\users\di203179\appdata\local\programs\python\python37-32\lib\subprocess.py", line 1230, in _wait
    timeout_millis)
KeyboardInterrupt
Traceback (most recent call last):
  File "c:\users\di203179\appdata\local\programs\python\python37-32\lib\site-packages\virtualenv.py", line 2611, in <module>
    main()
  File "c:\users\di203179\appdata\local\programs\python\python37-32\lib\site-packages\virtualenv.py", line 815, in main
    raise SystemExit(sub_process_call.wait())
  File "c:\users\di203179\appdata\local\programs\python\python37-32\lib\subprocess.py", line 990, in wait
    return self._wait(timeout=timeout)
  File "c:\users\di203179\appdata\local\programs\python\python37-32\lib\subprocess.py", line 1230, in _wait
    timeout_millis)
KeyboardInterrupt
Traceback (most recent call last):
  File "c:\users\di203179\appdata\local\programs\python\python37-32\lib\site-packages\virtualenv.py", line 2611, in <module>
    main()
  File "c:\users\di203179\appdata\local\programs\python\python37-32\lib\site-packages\virtualenv.py", line 815, in main
    raise SystemExit(sub_process_call.wait())
  File "c:\users\di203179\appdata\local\programs\python\python37-32\lib\subprocess.py", line 990, in wait
    return self._wait(timeout=timeout)
  File "c:\users\di203179\appdata\local\programs\python\python37-32\lib\subprocess.py", line 1230, in _wait
    timeout_millis)
KeyboardInterrupt
Traceback (most recent call last):
  File "c:\users\di203179\appdata\local\programs\python\python37-32\lib\site-packages\virtualenv.py", line 2611, in <module>
    main()
  File "c:\users\di203179\appdata\local\programs\python\python37-32\lib\site-packages\virtualenv.py", line 815, in main
    raise SystemExit(sub_process_call.wait())
  File "c:\users\di203179\appdata\local\programs\python\python37-32\lib\subprocess.py", line 990, in wait
    return self._wait(timeout=timeout)
  File "c:\users\di203179\appdata\local\programs\python\python37-32\lib\subprocess.py", line 1230, in _wait
    timeout_millis)
KeyboardInterrupt
Traceback (most recent call last):
  File "c:\users\di203179\appdata\local\programs\python\python37-32\lib\site-packages\virtualenv.py", line 2611, in <module>
    main()
  File "c:\users\di203179\appdata\local\programs\python\python37-32\lib\site-packages\virtualenv.py", line 815, in main
    raise SystemExit(sub_process_call.wait())
  File "c:\users\di203179\appdata\local\programs\python\python37-32\lib\subprocess.py", line 990, in wait
    return self._wait(timeout=timeout)
  File "c:\users\di203179\appdata\local\programs\python\python37-32\lib\subprocess.py", line 1230, in _wait
    timeout_millis)
KeyboardInterrupt
Traceback (most recent call last):
  File "c:\users\di203179\appdata\local\programs\python\python37-32\lib\site-packages\virtualenv.py", line 2611, in <module>
    main()
  File "c:\users\di203179\appdata\local\programs\python\python37-32\lib\site-packages\virtualenv.py", line 815, in main
    raise SystemExit(sub_process_call.wait())
  File "c:\users\di203179\appdata\local\programs\python\python37-32\lib\subprocess.py", line 990, in wait
    return self._wait(timeout=timeout)
  File "c:\users\di203179\appdata\local\programs\python\python37-32\lib\subprocess.py", line 1230, in _wait
    timeout_millis)
KeyboardInterrupt
Traceback (most recent call last):
  File "c:\users\di203179\appdata\local\programs\python\python37-32\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\di203179\appdata\local\programs\python\python37-32\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\di203179\AppData\Local\Programs\Python\Python37-32\Scripts\virtualenv.exe\__main__.py", line 9, in <module>
  File "c:\users\di203179\appdata\local\programs\python\python37-32\lib\site-packages\virtualenv.py", line 815, in main
    raise SystemExit(sub_process_call.wait())
  File "c:\users\di203179\appdata\local\programs\python\python37-32\lib\subprocess.py", line 990, in wait
    return self._wait(timeout=timeout)
  File "c:\users\di203179\appdata\local\programs\python\python37-32\lib\subprocess.py", line 1230, in _wait
    timeout_millis)
KeyboardInterrupt
Run Code Online (Sandbox Code Playgroud)

小智 6

可能您正在使用导致该错误的 virtualenv 模块的 16.6.1 版,请尝试使用以下代码安装 16.6.0:

 pip install virtualenv==16.6.0
Run Code Online (Sandbox Code Playgroud)

然后再次尝试创建虚拟环境。