MacOs Big Sur 11.0.1 安装python报错

❯ pyenv install 3.6.8
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.6.8.tar.xz...
-> https://www.python.org/ftp/python/3.6.8/Python-3.6.8.tar.xz
Installing Python-3.6.8...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk

BUILD FAILED (OS X 11.0.1 using python-build 20180424)

Inspect or clean up the working tree at /var/folders/bb/0bxy1cy57rb_pxdkvlyst3nh0000gn/T/python-build.20201120103846.92208
Results logged to /var/folders/bb/0bxy1cy57rb_pxdkvlyst3nh0000gn/T/python-build.20201120103846.92208.log

Last 10 log lines:
struct sf_hdtr sf;
^
./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);
^
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/ethanyan/.pyenv/versions/3.6.8/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl@1.1/include -I/Users/ethanyan/.pyenv/versions/3.6.8/include -I/usr/local/opt/openssl@1.1/include -DPy_BUILD_CORE -c ./Modules/_codecsmodule.c -o Modules/_codecsmodule.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/ethanyan/.pyenv/versions/3.6.8/include -I/usr/local/opt/openssl@1.1/include -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl@1.1/include -I/Users/ethanyan/.pyenv/versions/3.6.8/include -I/usr/local/opt/openssl@1.1/include -DPy_BUILD_CORE -c ./Modules/_weakref.c -o Modules/_weakref.o
2 errors generated.
make: *** [Modules/posixmodule.o] Error 1
make: *** Waiting for unfinished jobs....

MacOs Big Sur 11.0.1 安装python报错

Mac升级新版本之后,原有的开发环境不可用

1. 原有的开发环境安装了好几个Python版本;

2. 更新系统之后除自带的Python2.7之后,Python3环境均不可用;

3. 刚开始执行python3会报错 images not load,网上的回答都是缺失libZib依赖,然而我的并不是

4. 我开始卸载所有的python3环境,准备重新安装环境依赖;

5. 采用brew install python3安装成功,默认安装最高版本python;

6. 此时我准备采用pipenv重新创建虚拟环境,但是高版本的python目前虚拟化不出低版本python;

7. 我又开始采用pyenv这个包管理工具进行python多环境管理;捣腾了大半天才发现Mac11.0.1版本不支持pyenv;

8. 此时已经快要炸了。(后边已经找到了其他解决方案,文章最底部会有操作过程,但是我用了另一种方式)

9. 采用anaconda包管理工具。具体怎么操作可以百度。

Step 1 Align command-line tools

Open Xcode-beta.app
Go to Preference > Locations
Select the right version of command-line tools

Step 2 Install python

In this case, I installed 3.8.0. If you want to install a different version, you will need to change the version in the following command.
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.8.0 < <(curl -sSL https://github.com/python/cpython/commit/8ea6353.patch\?full_index\=1)
上一篇:PHP代码


下一篇:php 获取指定日期所在月份的最后一天