无法在 m1 Apple 芯片上安装 python 3.10.0 - ld:未找到架构 x86_64 的符号

coc*_*kid 18 arm python-3.x apple-m1

我正在尝试在我的 Apple M1 Silicon 上安装 python 3.10.0。

通过 asdf venv 管理器安装。3.7.9 和 3.9.4 工作没有任何问题,但安装 3.10.0 会导致以下错误:

Last 10 log lines:
  "_libintl_textdomain", referenced from:
      __locale_textdomain in libpython3.10.a(_localemodule.o)
      __locale_textdomain in libpython3.10.a(_localemodule.o)
ld: symbol(s) not found for architecture x86_64
ld: symbol(s) not found for architecture x86_64
clang: clangerror: linker command failed with exit code 1 (use -v to see invocation)
: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Programs/_testembed] Error 1
make: *** Waiting for unfinished jobs....
make: *** [python.exe] Error 1
Run Code Online (Sandbox Code Playgroud)

cmake版本3.22.0

Apple clang 版本 13.0.0 (clang-1300.0.29.3) 目标:x86_64-apple-darwin21.1.0 线程模型:posix InstalledDir:/Library/Developer/CommandLineTools/usr/bin

我尝试过的:

导出 ARCHFLAGS="-arch arm64"

以及来自的所有建议

无法在 MacOS 上使用 pyenv 安装 Python 3.10.0

提前非常感谢您,这让我发疯:-)

小智 32

  1. 首先安装gettext:
brew install gettext
Run Code Online (Sandbox Code Playgroud)
  1. 然后导出标志:
export LDFLAGS="-L/opt/homebrew/lib"; export CPPFLAGS="-I/opt/homebrew/include"
Run Code Online (Sandbox Code Playgroud)
  1. 最后安装python:
pyenv install 3.10.0
Run Code Online (Sandbox Code Playgroud)

这对我有用。我在这里找到它https://github.com/pyenv/pyenv/issues/1877#issuecomment-962514298