在使用python 3创建虚拟环境时,如何解决看似无止境的循环?

时间:2019-07-10 14:48:13

标签: 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

直到我击中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

2 个答案:

答案 0 :(得分:3)

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

 pip install virtualenv==16.6.0

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

答案 1 :(得分:0)

从virtualenv中更新到版本16.0.2。 尝试: pip install virtualenv --upgrade