寻找不存在的 virtualenv 的诗歌

poetry looking for virtualenv that isn't there

我是 Python 的新手,我第一次尝试安装项目依赖项和 运行 提供的单元测试。

项目使用了poetry和pytest。在 instructions on the website 之后,我已经在我的 Windows 机器上成功完成了 poetry 的全新安装,但是当尝试使用 poetry install 安装依赖项时,出现以下错误:

  EnvCommandError

  Command C:\Users\jon.doe\AppData\Local\pypoetry\Cache\virtualenvs\my-project-d9FwOK5-py3.8\Scripts\python.exe - errored with the following return code 1, and output:
  The system cannot find the path specified.
  input was : import sys

  if hasattr(sys, "real_prefix"):
      print(sys.real_prefix)
  elif hasattr(sys, "base_prefix"):
      print(sys.base_prefix)
  else:
      print(sys.prefix)


  at ~\.poetry\lib\poetry\utils\env.py:1101 in _run
      1097│                 output = subprocess.check_output(
      1098│                     cmd, stderr=subprocess.STDOUT, **kwargs
      1099│                 )
      1100│         except CalledProcessError as e:
    → 1101│             raise EnvCommandError(e, input=input_)
      1102│
      1103│         return decode(output)
      1104│
      1105│     def execute(self, bin, *args, **kwargs):

C:\Users\jon.doe\AppData\Local\pypoetry 不存在,所以这就是它找不到 virtualenv 的原因。我的配置设置为 create a virtualenv if one doesn't exist(默认情况下,我什么都没改变)。

为什么它在错误的地方查找,我如何为这个项目连接和启动 virtualenv 并 运行ning?

最后诗歌不是问题。我的 Windows 副本附带一个“python.exe”Python 安装程序,该安装程序有一个导致问题的环境变量 - 删除它解决了问题。