解决办法:
1.? ?安装?pyenv 及 pyenv-virtualenv
brew install pyenv
git clone https://github.com/yyuu/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv
pyenv安装python3.6.8 报错
CSDN首页
消息
发文助手
暂无建议
【标题规范】
macbook pyenv 安装 python3.6.8 报错
31 / 100
展示封面:
*
优质的封面有利于推荐,格式支持JPEG、PNG
文章标签:
分类专栏:
新建分类专栏
最多选择3个分类专栏#为二级分类
文章类型:
请选择
*
申请原创将启用 Creative Commons 版权模板,如果不是原创文章,请选择转载或翻译。 原创文章默认开启打赏, 打赏管理
发布形式:
收益中心
草稿已保存 22:59:49 共 3295 字
发布文章
<没有设置>
else if(0 == _NSGetExecutablePath(execpath, &nsexeclength) && execpath[0] == SEP) {
^~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/mach-o/dyld.h:98:54: note: passing argument to parameter 'bufsize' here
extern int _NSGetExecutablePath(char* buf, uint32_t* bufsize) __OSX_AVAILABLE_STARTING(__MAC_10_2, __IPHONE_2_0);
^
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -I. -I./Include -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl@1.1/include -I/Users/guangcui/.pyenv/versions/3.6.8/include -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl@1.1/include -I/Users/guangcui/.pyenv/versions/3.6.8/include -DPy_BUILD_CORE -c ./Modules/posixmodule.c -o Modules/posixmodule.o
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -std=c99 -Wextra -Wno-unused-result -Wno-unused-parameter -Wno-missing-field-initializers -Wstrict-prototypes -I. -I./Include -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl@1.1/include -I/Users/guangcui/.pyenv/versions/3.6.8/include -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl@1.1/include -I/Users/guangcui/.pyenv/versions/3.6.8/include -DPy_BUILD_CORE -c ./Modules/errnomodule.c -o Modules/errnomodule.o
./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. 重新安装 zlib bzip2
brew reinstall zlib bzip2
? 2. 基于使用的shell, 可以更新.zshrc 或.bashrc(如果没有该文本,可以在~目录下建议文件,输入下面内容然后保存然后重启shell)
export PATH="$HOME/.pyenv/bin:$PATH"
export PATH="/usr/local/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
export LDFLAGS="-L/usr/local/opt/zlib/lib -L/usr/local/opt/bzip2/lib"
export CPPFLAGS="-I/usr/local/opt/zlib/include -I/usr/local/opt/bzip2/include"
?3.? 输入以下安装命令如果需要改版本可以将3.6.8 改为其他版本
CFLAGS="-I$(brew --prefix openssl)/include -I$(brew --prefix bzip2)/include -I$(brew --prefix readline)/include -I$(xcrun --show-sdk-path)/usr/include" LDFLAGS="-L$(brew --prefix openssl)/lib -L$(brew --prefix readline)/lib -L$(brew --prefix zlib)/lib -L$(brew --prefix bzip2)/lib" pyenv install --patch 3.6.8 < <(curl -sSL https://github.com/python/cpython/commit/8ea6353.patch\?full_index\=1)
参考:https://stackoverflow.com/questions/66482346/problems-installing-python-3-6-with-pyenv-on-mac-os-big-sur/66483524
?https://github.com/pyenv/pyenv/issues/1737
https://www.jianshu.com/p/60f361822a7e
|