【问题标题】:poetry looking for virtualenv that isn't there寻找不存在的virtualenv的诗歌
【发布时间】:2021-11-10 16:14:52
【问题描述】:

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

该项目使用诗歌和pytest。我已经按照instructions on the website 在我的Windows 机器上成功完成了全新的诗歌安装,但是当尝试使用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?

【问题讨论】:

  • 如果你创建它正在寻找的目录会发生什么?我认为诗歌期望它存在,因此它可以在其中创建虚拟环境,但我可能会弄错
  • 或者,将诗歌设置为create the virtualenv in the project's root dir,即使在那里看起来也应该如此。

标签: python pytest python-poetry


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2022-06-15
    • 2022-08-11
    • 2020-08-08
    • 1970-01-01
    • 1970-01-01
    • 2021-05-28
    • 1970-01-01
    • 2022-08-17
    • 1970-01-01
    相关资源
    最近更新 更多