【问题标题】:set custom path for virtualenvs using poetry使用诗歌为 virtualenvs 设置自定义路径
【发布时间】:2021-02-27 22:35:32
【问题描述】:

我正在为我的项目尝试诗歌,并希望将所有虚拟环境存储在一个地方以便于搜索。我似乎无法让这个命令工作:

PS C:\Users\********\pyprojects\******> poetry config virtualenvs.path: "C:\Users\********\pyprojects\.venv"

  ValueError

  Setting virtualenvs.path: does not exist

  at ~\.poetry\lib\poetry\console\commands\config.py:248 in handle
      244│                 raise ValueError("You must pass exactly 1 value")
      245│
      246│             return 0
      247│
    → 248│         raise ValueError("Setting {} does not exist".format(self.argument("key")))
      249│
      250│     def _handle_single_value(self, source, key, callbacks, values):
      251│         validator, normalizer, _ = callbacks
      252│

来自https://python-poetry.org/docs/configuration/

virtualenvs.path: 字符串 将在其中创建虚拟环境的目录。默认为 {cache-dir}/virtualenvs(Windows 上为 {cache-dir}\virtualenvs)。

我试过用单引号,不带引号。也不工作。我错过了什么?

【问题讨论】:

  • 删除冒号:poetry config virtualenvs.path "C:\Users\********\pyprojects\.venv"

标签: python path virtualenv python-poetry


【解决方案1】:

试试不带冒号:

PS C:\Users\********\pyprojects\******> poetry config virtualenvs.path: "C:\Users\********\pyprojects\.venv"
                                                                      ^
                                                      unnecessary colon

所以你的命令实际上是

poetry config virtualenvs.path "C:\Users\********\pyprojects\.venv"

【讨论】:

    【解决方案2】:

    好吧,我傻了……

    C:\Users\********\pyprojects\******> poetry config virtualenvs.path C:\Users\********\pyprojects\.venv
    

    它可以不带引号和不带冒号

    【讨论】:

    • 没关系,“愚蠢”的错误是学习过程的一部分?
    猜你喜欢
    • 1970-01-01
    • 2022-10-22
    • 1970-01-01
    • 1970-01-01
    • 2023-03-31
    • 1970-01-01
    • 2019-01-02
    • 1970-01-01
    • 2020-06-23
    相关资源
    最近更新 更多