尝试通过以下方式安装python 3:
LDFLAGS="-L/opt/local/lib/" CPPFLAGS="-I/opt/local/include -L/opt /local/lib" C_INCLUDE_PATH="/opt/local/include" LIBRARY_PATH=" /opt/local/lib" pyenv install 3.7.3
我得到:
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.7.3.tar.xz...
-> https://www.python.org/ftp/python/3.7.3/Python-3.7.3.tar.xz
Installing Python-3.7.3...
python-build: use readline from homebrew
BUILD FAILED (OS X 10.15.4 using python-build 20180424)
Inspect or clean up the working tree at /var/folders/qg/bfsy6h2j1_76gh41ngnnwgdh0000gn/T/python-build.20200508155826.1859
Results logged to /var/folders/qg/bfsy6h2j1_76gh41ngnnwgdh0000gn/T/python-build.20200508155826.1859.log
Last 10 log lines:
checking for --enable-universalsdk... no
checking for --with-universal-archs... no
checking MACHDEP... checking for --without-gcc... no
checking for --with-icc... no
checking for gcc... clang
checking whether the C compiler works... no
configure: error: in `/var/folders/qg/bfsy6h2j1_76gh41ngnnwgdh0000gn/T/python-build.20200508155826.1859/Python-3.7.3':
configure: error: C compiler cannot create executables
See `config.log' for more details
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
此问题的其他解决方案不太相同,我没有看到与pyenv相关的此错误,有任何线索吗?我以前在python3上安装了自制软件,但我怀疑这是造成日志错误的罪魁祸首。
我已经安装了命令行工具。
答案 0 :(得分:0)
如果您正在使用WSL2 ubuntu并通过自制程序安装pyenv,解决此问题的一种方法是安装build-essential
及其朋友。
sudo apt-get update; sudo apt-get install --no-install-recommends make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
参考the pyenv official guide。它也具有linuxbrew,macOS和其他操作系统。