常见问题
pyenv install 3.6.7 失败
环境: macOs big Sur 11.2.2
pyenv: 1.2.23
相关日志
1┌─[jianglin]─[~/repo/golang/src/alarm](master)
2└──╼ pyenv install 3.6.7
3python-build: use openssl@1.1 from homebrew
4python-build: use readline from homebrew
5Installing Python-3.6.7...
6python-build: use readline from homebrew
7python-build: use zlib from xcode sdk
8
9BUILD FAILED (OS X 11.2.2 using python-build 20180424)
10
11Inspect or clean up the working tree at /var/folders/44/hnrgfyfn0fsb8lqwk_0h2jvm0000gn/T/python-build.20210318151243.78376
12Results logged to /var/folders/44/hnrgfyfn0fsb8lqwk_0h2jvm0000gn/T/python-build.20210318151243.78376.log
13
14Last 10 log lines:
15 ret = sendfile(in, out, offset, &sbytes, &sf, flags);
16 ^
17./Modules/posixmodule.c:10433:5: warning: code will never be executed [-Wunreachable-code]
18 Py_FatalError("abort() called from Python code didn't abort!");
19 ^~~~~~~~~~~~~
20clang -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/jianglin/repo/python/pyenv/versions/3.6.7/include -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/usr/local/opt/openssl@1.1/include -I/Users/jianglin/repo/python/pyenv/versions/3.6.7/include -DPy_BUILD_CORE -c ./Modules/pwdmodule.c -o Modules/pwdmodule.o
211 warning and 1 error generated.
22make: *** [Modules/posixmodule.o] Error 1
23make: *** Waiting for unfinished jobs....
241 warning generated.
25┌─[jianglin]─[~/repo/golang/src/alarm](master)
26└──╼ pyenv install --patch 3.6.7 < <(curl -sSL https://github.com/python/cpython/commit/8ea6353.patch\?full_index\=1)
27python-build: use openssl@1.1 from homebrew
28python-build: use readline from homebrew
29Installing Python-3.6.7...
30curl: (28) Operation timed out after 300188 milliseconds with 0 out of 0 bytes received
31python-build: use readline from homebrew
32python-build: use zlib from xcode sdk
33
34BUILD FAILED (OS X 11.2.2 using python-build 20180424)
35
36Inspect or clean up the working tree at /var/folders/44/hnrgfyfn0fsb8lqwk_0h2jvm0000gn/T/python-build.20210318151644.86904
37Results logged to /var/folders/44/hnrgfyfn0fsb8lqwk_0h2jvm0000gn/T/python-build.20210318151644.86904.log
38
39Last 10 log lines:
40./Modules/posixmodule.c:8211:15: error: implicit declaration of function 'sendfile' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
41 ret = sendfile(in, out, offset, &sbytes, &sf, flags);
42 ^
43./Modules/posixmodule.c:10433:5: warning: code will never be executed [-Wunreachable-code]
44 Py_FatalError("abort() called from Python code didn't abort!");
45 ^~~~~~~~~~~~~
461 warning and 1 error generated.
47make: *** [Modules/posixmodule.o] Error 1
48make: *** Waiting for unfinished jobs....
491 warning generated.
解决方式
1┌─[jianglin]─[~/repo/golang/src/alarm](master)
2└──╼ CFLAGS=-Wno-implicit-function-declaration pyenv install --patch 3.6.7 < <(curl -sSL https://github.com/python/cpython/commit/8ea6353.patch\?full_index\=1)
3python-build: use [email protected] from homebrew
4python-build: use readline from homebrew
5Installing Python-3.6.7...
6curl: (7) Failed to connect to github.com port 443: Operation timed out
7python-build: use readline from homebrew
8python-build: use zlib from xcode sdk
9Installed Python-3.6.7 to /Users/jianglin/repo/python/pyenv/versions/3.6.7
知识共享署名-非商业性使用-相同方式共享4.0国际许可协议