Mac OS 上的诗歌安装失败,显示“should_use_symlinks”

con*_*ies 25 python macos installation python-poetry

我正在尝试使用以下命令安装诗歌

curl -sSL https://install.python-poetry.org | python3 -
Run Code Online (Sandbox Code Playgroud)

但它失败了,但有以下例外:

例外:此版本的 python 无法在不使用符号链接的情况下创建 venvs

下面是详细说明错误的文本

Retrieving Poetry metadata

# Welcome to Poetry!

This will download and install the latest version of Poetry,
a dependency and package manager for Python.

It will add the `poetry` command to Poetry's bin directory, located at:

/Users/DaftaryG/.local/bin

You can uninstall at any time by executing this script with the --uninstall option,
and these changes will be reverted.

Installing Poetry (1.2.1): Creating environment
Traceback (most recent call last):
  File "<stdin>", line 940, in <module>
  File "<stdin>", line 919, in main
  File "<stdin>", line 550, in run
  File "<stdin>", line 571, in install
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/contextlib.py", line 117, in __enter__
    return next(self.gen)
  File "<stdin>", line 643, in make_env
  File "<stdin>", line 629, in make_env
  File "<stdin>", line 309, in make
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/venv/__init__.py", line 66, in __init__
    self.symlinks = should_use_symlinks(symlinks)
  File "/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/venv/__init__.py", line 31, in should_use_symlinks
    raise Exception("This build of python cannot create venvs without using symlinks")
Exception: This build of python cannot create venvs without using symlinks
Run Code Online (Sandbox Code Playgroud)

我已经安装了符号链接,所以没有安装似乎不是问题。有人知道这个错误的原因吗?

Ale*_*lex 34

这不是最好的解决方案,但如果有的话,您可以使用 Homebrew 安装它。我就是这么做的。

brew install poetry
Run Code Online (Sandbox Code Playgroud)


j0h*_*nta 5

我有同样的错误。

就我而言,问题是 pyenv 设置的 python 全局版本不是 python 3.x。

所以

pyenv global 3.x.x
Run Code Online (Sandbox Code Playgroud)

修复。


alp*_*lps 5

有同样的问题。上述解决方案不起作用。brew install 对我来说不是一个好的解决方案(请参阅这篇文章了解原因)。

所以我想了一下,这有效,而且只是官方推荐安装的一个调整版本(不是brew install)

具体来说,当指定主要+次要版本控制时,它起作用了。

pyenv install 3.10.1
pyenv global 3.10.1
curl -sSL https://install.python-poetry.org | python3.10 -
Run Code Online (Sandbox Code Playgroud)

python python3使用major.minor(例如或)以外的任何内容python3.10.1都会导致您遇到的符号链接错误。