如何解决在 macOS 上使用 pyenv 安装 python 3.8 失败
使用 pyenv
安装 python 3.8.8 失败。
安装失败如下:
$pyenv install 3.8.8
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.8.8.tar.xz...
-> https://www.python.org/ftp/python/3.8.8/Python-3.8.8.tar.xz
Installing Python-3.8.8...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
BUILD FAILED (OS X 10.15.7 using python-build 20180424)
Inspect or clean up the working tree at /var/folders/d6/m67jyndd7h754m3810cl3bpm0000gp/T/python-build.20210323082704.55952
Results logged to /var/folders/d6/m67jyndd7h754m3810cl3bpm0000gp/T/python-build.20210323082704.55952.log
Last 10 log lines:
checking for python3.8... no
checking for python3... python3
checking for --enable-universalsdk... no
checking for --with-universal-archs... no
checking MACHDEP... "darwin"
checking for gcc... clang
checking whether the C compiler works... no
configure: error: in `/var/folders/d6/m67jyndd7h754m3810cl3bpm0000gp/T/python-build.20210323082704.55952/Python-3.8.8':
configure: error: C compiler cannot create executables
See `config.log' for more details
我在 Catalina 上安装了最新的 xcode
$/usr/bin/xcodebuild -version
Xcode 12.4
Build version 12D4e
gcc 看起来很合理:
$which gcc
/usr/bin/gcc
$gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
以下是关于 clang
的信息:
$which clang
/usr/bin/clang
09:17:36/Python-3.8.8 $clang -v
Apple clang version 12.0.0 (clang-1200.0.32.29)
Target: x86_64-apple-darwin19.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
更新以下是 config.log
中的一些错误:有关于 clang 的投诉:
configure:3869: clang -V >&5
clang: error: argument to '-V' is missing (expected 1 value)
clang: error: no input files
configure:3880: $? = 1
configure:3869: clang -qversion >&5
clang: error: unknown argument '-qversion'; did you mean '--version'?
clang: error: no input files
...
configure:3922: clang -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/Users/steve/.pyenv/versions/3.8.8/include -I/usr/local/opt/openssl@1.1/include-isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/Users/steve/.pyenv/versions/3.8.8/lib -L/usr/local/opt/openssl@1.1/lib conftest.c >&5
clang: warning: no such sysroot directory: '/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk-isysroot' [-Wmissing-sysroot]
ld: warning: directory not found for option '-L/opt/local/lib'
ld: can't map file,errno=22 file '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
请注意,我已经浏览了 PyEnv BUILD FAILED installing Python on MacOS 处的答案。例如,我尝试了以下操作:
export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
export MACOSX_DEPLOYMENT_TARGET=10.15
pyenv install 3.8.8
但它以同样的方式失败了。我还应该检查什么?如何解决?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。