在我的 MacBook Air OS Big Sur 上安装 Python 3.6.13 时,使用命令 pyenv install 3.6.13 我收到此错误:
Installing Python-3.6.13...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
BUILD FAILED (OS X 11.3 using python-build 20180424)
Inspect or clean up the working tree at /var/folders/7j/0qtpb8vs1_s34ynv0f6rrs840000gn/T/python-build.20210304114832.65954
Results logged to /var/folders/7j/0qtpb8vs1_s34ynv0f6rrs840000gn/T/python-build.20210304114832.65954.log
Last 10 log lines:
./Modules/posixmodule.c:8210:15: error: implicit declaration of function 'sendfile' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
ret = sendfile(in, out, offset, &sbytes, &sf, flags);
^
./Modules/posixmodule.c:10432:5: warning: code will never be executed [-Wunreachable-code]
Py_FatalError("abort() called from Python code didn't abort!");
^~~~~~~~~~~~~
1 warning and 1 error generated.
1 warning generated.
make: *** [Modules/posixmodule.o] Error 1
make: *** Waiting for unfinished jobs....
非常感谢有关如何解决此问题或安装 python 3.6.13 的其他解决方法的任何建议。我目前有 python 3.8,但需要 3.6 才能运行:
conda install -c deezer-research spleeter
原文由 Jacob Anderson 发布,翻译遵循 CC BY-SA 4.0 许可协议
感谢 jordanm,解决方案是遵循 https://github.com/pyenv/pyenv/issues/1740#issuecomment-738749988
从人们的评论(感谢 Lukasz Czerwinski 和 Alex Veksler)来看,似乎很多人认为下一步是可选的(甚至是危险的)并且更愿意跳过它;不过,如果没有其他方法,值得一试:
无论您是否选择跳过最后一步,继续编辑
.zshrc
或.bashrc
使用:并添加:
编辑并保存该文件后,运行:
然后运行下面的命令进行安装(更改 3.6.0 以获得所需的补丁)