无法在 MacOS 上使用 pyenv 安装 Python 3.10.0
Can't install Python 3.10.0 with pyenv on MacOS
尝试使用 pyenv 2.1.0(来自自制软件)在 MacOS 11.6 (Intel) 上安装 Python 3.10.0 失败:
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.10.0.tar.xz...
-> https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tar.xz
Installing Python-3.10.0...
python-build: use tcl-tk from homebrew
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
BUILD FAILED (OS X 11.6 using python-build 20180424)
Inspect or clean up the working tree at /var/folders/rk/_qysk9hs40qcq14h44l57wch0000gn/T/python-build.20211006114013.40649
Results logged to /var/folders/rk/_qysk9hs40qcq14h44l57wch0000gn/T/python-build.20211006114013.40649.log
Last 10 log lines:
checking MACHDEP... "darwin"
checking for gcc... clang
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in `/var/folders/rk/_qysk9hs40qcq14h44l57wch0000gn/T/python-build.20211006114013.40649/Python-3.10.0':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
make: *** No targets specified and no makefile found. Stop.
构建文件夹中的 config.log 包含:
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by python configure 3.10, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ ./configure --prefix=/Users/jonas.obrist/.pyenv/versions/3.10.0 --libdir=/Users/jonas.obrist/.pyenv/versions/3.10.0/lib --with-openssl=/usr/local/opt/openssl@1.1 --with-tcltk-libs=-L/usr/local/opt/tcl-tk/lib -ltcl8.6 -ltk8.6 --with-tcltk-includes=-I/usr/local/opt/tcl-tk/include
## --------- ##
## Platform. ##
## --------- ##
hostname = Jonas-MBP-2018.local
uname -m = x86_64
uname -r = 20.6.0
uname -s = Darwin
uname -v = Darwin Kernel Version 20.6.0: Mon Aug 30 06:12:21 PDT 2021; root:xnu-7195.141.6~3/RELEASE_X86_64
/usr/bin/uname -p = i386
/bin/uname -X = unknown
/bin/arch = unknown
/usr/bin/arch -k = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo = Mach kernel version:
Darwin Kernel Version 20.6.0: Mon Aug 30 06:12:21 PDT 2021; root:xnu-7195.141.6~3/RELEASE_X86_64
Kernel configured for up to 12 processors.
6 processors are physically available.
12 processors are logically available.
Processor type: x86_64h (Intel x86-64h Haswell)
Processors active: 0 1 2 3 4 5 6 7 8 9 10 11
Primary memory available: 32.00 gigabytes
Default processor set: 614 tasks, 3158 threads, 12 processors
Load average: 2.13, Mach factor: 9.85
/bin/machine = unknown
/usr/bin/oslevel = unknown
/bin/universe = unknown
PATH: /usr/local/Cellar/pyenv/HEAD-483d95d/libexec
PATH: /usr/local/Cellar/pyenv/HEAD-483d95d/plugins/python-build/bin
PATH: /Users/jonas.obrist/.poetry/bin
PATH: /Users/jonas.obrist/.rbenv/shims
PATH: /usr/local/opt/llvm/bin
PATH: /usr/local/opt/libxml2/bin
PATH: /Users/jonas.obrist/.poetry/bin/
PATH: /Users/jonas.obrist/.cargo/bin
PATH: /Users/jonas.obrist/.local/bin
PATH: /Users/jonas.obrist/.fastlane/bin
PATH: /Users/jonas.obrist/.gem/bin
PATH: /Users/jonas.obrist/.pyenv/shims
PATH: /Users/jonas.obrist/.pyenv/bin
PATH: /usr/local/bin
PATH: /usr/bin
PATH: /bin
PATH: /usr/sbin
PATH: /sbin
PATH: /Library/Apple/usr/bin
PATH: /Users/jonas.obrist/go/bin
## ----------- ##
## Core tests. ##
## ----------- ##
configure:2878: checking build system type
configure:2892: result: x86_64-apple-darwin20.6.0
configure:2912: checking host system type
configure:2925: result: x86_64-apple-darwin20.6.0
configure:2955: checking for python3.10
configure:2971: found /Users/jonas.obrist/.pyenv/shims/python3.10
configure:2982: result: python3.10
configure:3076: checking for --enable-universalsdk
configure:3123: result: no
configure:3147: checking for --with-universal-archs
configure:3162: result: no
configure:3318: checking MACHDEP
configure:3369: result: "darwin"
configure:3653: checking for gcc
configure:3680: result: clang
configure:3909: checking for C compiler version
configure:3918: clang --version >&5
Homebrew clang version 12.0.1
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin
configure:3929: $? = 0
configure:3918: clang -v >&5
Homebrew clang version 12.0.1
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin
configure:3929: $? = 0
configure:3918: clang -V >&5
clang-12: error: argument to '-V' is missing (expected 1 value)
clang-12: error: no input files
configure:3929: $? = 1
configure:3918: clang -qversion >&5
clang-12: error: unknown argument '-qversion'; did you mean '--version'?
clang-12: error: no input files
configure:3929: $? = 1
configure:3949: checking whether the C compiler works
configure:3971: clang -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/Users/jonas.obrist/.pyenv/versions/3.10.0/include -I/usr/local/opt/openssl/include -L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/Users/jonas.obrist/.pyenv/versions/3.10.0/lib -L/usr/local/opt/openssl/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib conftest.c >&5
ld: warning: directory not found for option '-L/Users/jonas.obrist/.pyenv/versions/3.10.0/lib'
configure:3975: $? = 0
configure:4023: result: yes
configure:4026: checking for C compiler default output file name
configure:4028: result: a.out
configure:4034: checking for suffix of executables
configure:4041: clang -o conftest -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/Users/jonas.obrist/.pyenv/versions/3.10.0/include -I/usr/local/opt/openssl/include -L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/Users/jonas.obrist/.pyenv/versions/3.10.0/lib -L/usr/local/opt/openssl/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib conftest.c >&5
ld: warning: directory not found for option '-L/Users/jonas.obrist/.pyenv/versions/3.10.0/lib'
configure:4045: $? = 0
configure:4067: result:
configure:4089: checking whether we are cross compiling
configure:4097: clang -o conftest -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/Users/jonas.obrist/.pyenv/versions/3.10.0/include -I/usr/local/opt/openssl/include -L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/Users/jonas.obrist/.pyenv/versions/3.10.0/lib -L/usr/local/opt/openssl/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib conftest.c >&5
In file included from conftest.c:8:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:64:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:93:16: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
unsigned char *_base;
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:93:16: note: insert '_Nullable' if the pointer may be null
unsigned char *_base;
^
_Nullable
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:93:16: note: insert '_Nonnull' if the pointer should never be null
unsigned char *_base;
^
_Nonnull
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:138:32: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
int (* _Nullable _read) (void *, char *, int);
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:138:32: note: insert '_Nullable' if the pointer may be null
int (* _Nullable _read) (void *, char *, int);
^
_Nullable
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:138:32: note: insert '_Nonnull' if the pointer should never be null
int (* _Nullable _read) (void *, char *, int);
^
_Nonnull
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:138:40: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
int (* _Nullable _read) (void *, char *, int);
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:138:40: note: insert '_Nullable' if the pointer may be null
int (* _Nullable _read) (void *, char *, int);
^
_Nullable
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:138:40: note: insert '_Nonnull' if the pointer should never be null
int (* _Nullable _read) (void *, char *, int);
^
_Nonnull
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:139:35: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
fpos_t (* _Nullable _seek) (void *, fpos_t, int);
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:139:35: note: insert '_Nullable' if the pointer may be null
fpos_t (* _Nullable _seek) (void *, fpos_t, int);
^
_Nullable
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:139:35: note: insert '_Nonnull' if the pointer should never be null
fpos_t (* _Nullable _seek) (void *, fpos_t, int);
^
_Nonnull
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:140:32: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
int (* _Nullable _write)(void *, const char *, int);
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:140:32: note: insert '_Nullable' if the pointer may be null
int (* _Nullable _write)(void *, const char *, int);
^
_Nullable
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:140:32: note: insert '_Nonnull' if the pointer should never be null
int (* _Nullable _write)(void *, const char *, int);
^
_Nonnull
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:140:46: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
int (* _Nullable _write)(void *, const char *, int);
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:140:46: note: insert '_Nullable' if the pointer may be null
int (* _Nullable _write)(void *, const char *, int);
^
_Nullable
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:140:46: note: insert '_Nonnull' if the pointer should never be null
int (* _Nullable _write)(void *, const char *, int);
^
_Nonnull
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:144:18: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
struct __sFILEX *_extra; /* additions to FILE to not break ABI */
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:144:18: note: insert '_Nullable' if the pointer may be null
struct __sFILEX *_extra; /* additions to FILE to not break ABI */
^
_Nullable
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:144:18: note: insert '_Nonnull' if the pointer should never be null
struct __sFILEX *_extra; /* additions to FILE to not break ABI */
^
_Nonnull
In file included from conftest.c:8:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:220:5: error: 'TARGET_OS_IPHONE' is not defined, evaluates to 0 [-Werror,-Wundef-prefix=TARGET_OS_]
#if TARGET_OS_IPHONE
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:67:13: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
extern FILE *__stdinp;
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:67:13: note: insert '_Nullable' if the pointer may be null
extern FILE *__stdinp;
^
_Nullable
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:67:13: note: insert '_Nonnull' if the pointer should never be null
extern FILE *__stdinp;
^
_Nonnull
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:386:41: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
int (* _Nullable)(void *, const char *, int),
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:386:41: note: insert '_Nullable' if the pointer may be null
int (* _Nullable)(void *, const char *, int),
^
_Nullable
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:386:41: note: insert '_Nonnull' if the pointer should never be null
int (* _Nullable)(void *, const char *, int),
^
_Nonnull
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:386:55: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
int (* _Nullable)(void *, const char *, int),
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:386:55: note: insert '_Nullable' if the pointer may be null
int (* _Nullable)(void *, const char *, int),
^
_Nullable
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:386:55: note: insert '_Nonnull' if the pointer should never be null
int (* _Nullable)(void *, const char *, int),
^
_Nonnull
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:387:44: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
fpos_t (* _Nullable)(void *, fpos_t, int),
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:387:44: note: insert '_Nullable' if the pointer may be null
fpos_t (* _Nullable)(void *, fpos_t, int),
^
_Nullable
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:387:44: note: insert '_Nonnull' if the pointer should never be null
fpos_t (* _Nullable)(void *, fpos_t, int),
^
_Nonnull
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:388:41: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
int (* _Nullable)(void *));
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:388:41: note: insert '_Nullable' if the pointer may be null
int (* _Nullable)(void *));
^
_Nullable
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:388:41: note: insert '_Nonnull' if the pointer should never be null
int (* _Nullable)(void *));
^
_Nonnull
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:384:6: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
FILE *funopen(const void *,
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:384:6: note: insert '_Nullable' if the pointer may be null
FILE *funopen(const void *,
^
_Nullable
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:384:6: note: insert '_Nonnull' if the pointer should never be null
FILE *funopen(const void *,
^
_Nonnull
13 warnings and 1 error generated.
configure:4101: $? = 1
configure:4108: ./conftest
./configure: line 4110: ./conftest: No such file or directory
configure:4112: $? = 127
configure:4119: error: in `/var/folders/rk/_qysk9hs40qcq14h44l57wch0000gn/T/python-build.20211006114013.40649/Python-3.10.0':
configure:4121: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
## ---------------- ##
## Cache variables. ##
## ---------------- ##
ac_cv_build=x86_64-apple-darwin20.6.0
ac_cv_env_CC_set=set
ac_cv_env_CC_value=clang
ac_cv_env_CFLAGS_set=set
ac_cv_env_CFLAGS_value='-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include '
ac_cv_env_CPPFLAGS_set=set
ac_cv_env_CPPFLAGS_value='-I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/Users/jonas.obrist/.pyenv/versions/3.10.0/include -I/usr/local/opt/openssl/include'
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_LDFLAGS_set=set
ac_cv_env_LDFLAGS_value='-L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/Users/jonas.obrist/.pyenv/versions/3.10.0/lib -L/usr/local/opt/openssl/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib'
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_MACHDEP_set=
ac_cv_env_MACHDEP_value=
ac_cv_env_PROFILE_TASK_set=
ac_cv_env_PROFILE_TASK_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_host=x86_64-apple-darwin20.6.0
ac_cv_prog_PYTHON_FOR_REGEN=python3.10
ac_cv_prog_ac_ct_CC=clang
## ----------------- ##
## Output variables. ##
## ----------------- ##
ABIFLAGS=''
ALT_SOABI=''
AR=''
ARCH_RUN_32BIT=''
ARFLAGS=''
BASECFLAGS=''
BASECPPFLAGS=''
BINLIBDEST=''
BLDLIBRARY=''
BLDSHARED=''
BUILDEXEEXT=''
CC='clang'
CCSHARED=''
CFLAGS='-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include '
CFLAGSFORSHARED=''
CFLAGS_ALIASING=''
CFLAGS_NODIST=''
CONFIGURE_MACOSX_DEPLOYMENT_TARGET=''
CONFIG_ARGS=' '\''--prefix=/Users/jonas.obrist/.pyenv/versions/3.10.0'\'' '\''--libdir=/Users/jonas.obrist/.pyenv/versions/3.10.0/lib'\'' '\''--with-openssl=/usr/local/opt/openssl@1.1'\'' '\''--with-tcltk-libs=-L/usr/local/opt/tcl-tk/lib -ltcl8.6 -ltk8.6'\'' '\''--with-tcltk-includes=-I/usr/local/opt/tcl-tk/include'\'' '\''CC=clang'\'' '\''CFLAGS=-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include '\'' '\''LDFLAGS=-L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/Users/jonas.obrist/.pyenv/versions/3.10.0/lib -L/usr/local/opt/openssl/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib'\'' '\''CPPFLAGS=-I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/Users/jonas.obrist/.pyenv/versions/3.10.0/include -I/usr/local/opt/openssl/include'\'''
CPP=''
CPPFLAGS='-I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/Users/jonas.obrist/.pyenv/versions/3.10.0/include -I/usr/local/opt/openssl/include'
CXX=''
DEFS=''
DEF_MAKE_ALL_RULE=''
DEF_MAKE_RULE=''
DFLAGS=''
DLINCLDIR=''
DLLLIBRARY=''
DTRACE=''
DTRACE_HEADERS=''
DTRACE_OBJS=''
DYNLOADFILE=''
ECHO_C='\c'
ECHO_N=''
ECHO_T=''
EGREP=''
ENSUREPIP=''
EXEEXT=''
EXPORTSFROM=''
EXPORTSYMS=''
EXPORT_MACOSX_DEPLOYMENT_TARGET='#'
EXT_SUFFIX=''
FRAMEWORKALTINSTALLFIRST=''
FRAMEWORKALTINSTALLLAST=''
FRAMEWORKINSTALLAPPSPREFIX=''
FRAMEWORKINSTALLFIRST=''
FRAMEWORKINSTALLLAST=''
FRAMEWORKPYTHONW=''
FRAMEWORKUNIXTOOLSPREFIX='/Users/jonas.obrist/.pyenv/versions/3.10.0'
GITBRANCH=''
GITTAG=''
GITVERSION=''
GNULD=''
GREP=''
HAS_GIT='no-repository'
HAVE_GETHOSTBYNAME=''
HAVE_GETHOSTBYNAME_R=''
HAVE_GETHOSTBYNAME_R_3_ARG=''
HAVE_GETHOSTBYNAME_R_5_ARG=''
HAVE_GETHOSTBYNAME_R_6_ARG=''
INSTALL_DATA=''
INSTALL_PROGRAM=''
INSTALL_SCRIPT=''
INSTSONAME=''
LDCXXSHARED=''
LDFLAGS='-L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/Users/jonas.obrist/.pyenv/versions/3.10.0/lib -L/usr/local/opt/openssl/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib'
LDFLAGS_NODIST=''
LDLIBRARY=''
LDLIBRARYDIR=''
LDSHARED=''
LDVERSION=''
LIBC=''
LIBFFI_INCLUDEDIR=''
LIBM=''
LIBOBJS=''
LIBPL=''
LIBPYTHON=''
LIBRARY=''
LIBRARY_DEPS=''
LIBS=''
LIBTOOL_CRUFT=''
LINKCC=''
LINKFORSHARED=''
LIPO_32BIT_FLAGS=''
LIPO_INTEL64_FLAGS=''
LLVM_AR=''
LLVM_AR_FOUND=''
LLVM_PROFDATA=''
LLVM_PROF_ERR=''
LLVM_PROF_FILE=''
LLVM_PROF_FOUND=''
LLVM_PROF_MERGER=''
LN=''
LTLIBOBJS=''
MACHDEP='darwin'
MACHDEP_OBJS=''
MAINCC=''
MKDIR_P=''
MULTIARCH=''
MULTIARCH_CPPFLAGS=''
NO_AS_NEEDED=''
OBJEXT=''
OPENSSL_INCLUDES=''
OPENSSL_LDFLAGS=''
OPENSSL_LIBS=''
OPENSSL_RPATH=''
OPT=''
OTHER_LIBTOOL_OPT=''
PACKAGE_BUGREPORT='https://bugs.python.org/'
PACKAGE_NAME='python'
PACKAGE_STRING='python 3.10'
PACKAGE_TARNAME='python'
PACKAGE_URL=''
PACKAGE_VERSION='3.10'
PATH_SEPARATOR=':'
PGO_PROF_GEN_FLAG=''
PGO_PROF_USE_FLAG=''
PKG_CONFIG=''
PLATFORM_TRIPLET=''
PLATLIBDIR=''
PROFILE_TASK=''
PY3LIBRARY=''
PYTHONFRAMEWORK=''
PYTHONFRAMEWORKDIR='no-framework'
PYTHONFRAMEWORKIDENTIFIER='org.python.python'
PYTHONFRAMEWORKINSTALLDIR=''
PYTHONFRAMEWORKPREFIX=''
PYTHON_FOR_BUILD='./$(BUILDPYTHON) -E'
PYTHON_FOR_REGEN='python3.10'
PY_ENABLE_SHARED=''
READELF=''
RUNSHARED=''
SED=''
SHELL='/bin/sh'
SHLIBS=''
SHLIB_SUFFIX=''
SOABI=''
SOVERSION='1.0'
SRCDIRS=''
STATIC_LIBPYTHON=''
TCLTK_INCLUDES=''
TCLTK_LIBS=''
TEST_MODULES=''
THREADHEADERS=''
TRUE=''
TZPATH=''
UNIVERSALSDK=''
UNIVERSAL_ARCH_FLAGS=''
VERSION='3.10'
WHEEL_PKG_DIR=''
_PYTHON_HOST_PLATFORM=''
ac_ct_AR=''
ac_ct_CC='clang'
ac_ct_CXX=''
ac_ct_READELF=''
bindir='${exec_prefix}/bin'
build='x86_64-apple-darwin20.6.0'
build_alias=''
build_cpu='x86_64'
build_os='darwin20.6.0'
build_vendor='apple'
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='NONE'
host='x86_64-apple-darwin20.6.0'
host_alias=''
host_cpu='x86_64'
host_os='darwin20.6.0'
host_vendor='apple'
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
libdir='/Users/jonas.obrist/.pyenv/versions/3.10.0/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='/Users/jonas.obrist/.pyenv/versions/3.10.0'
program_transform_name='s,x,x,'
psdir='${docdir}'
runstatedir='${localstatedir}/run'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target_alias=''
## ----------- ##
## confdefs.h. ##
## ----------- ##
/* confdefs.h */
#define _GNU_SOURCE 1
#define _NETBSD_SOURCE 1
#define __BSD_VISIBLE 1
#define _DARWIN_C_SOURCE 1
#define _PYTHONFRAMEWORK ""
configure: exit 1
我可以通过下载 tarball 和 ./configure && make
手动构建它
如何安装它?
尝试env ARCHFLAGS="-arch x86_64"
(这对我适用于其他 Python 相关工具,我自己不使用 pyenv)。
基本原理:现代 macOS 支持 2 种架构:intel (x86_64) 和 m1(arm-something)。仅针对一种架构进行编译更容易。
抱歉,仍然不知道为什么,但我只是尝试了一下,它对我有用(下面的终端输出)。我是 运行 Mac OS Big Sur,版本 11.5.2,配备 Intel i7 处理器。我的pyenv版本也是最新的(2.1.0)
$ pyenv install 3.10.0
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.10.0.tar.xz...
-> https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tar.xz
Installing Python-3.10.0...
python-build: use tcl-tk from homebrew
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
Installed Python-3.10.0 to /Users/myuser/.pyenv/versions/3.10.0
在此之前我做了:
brew update && brew upgrade pyenv
问题是我安装了第二个版本的 clang(通过自制软件),这干扰了构建。在 运行 brew uninstall llvm
pyenv/python-build 从 xcode 中选择了 clang 之后,现在 pyenv 又开始工作了。
我有一个类似的问题,通过将 $CC
环境变量设置为 clang
.
解决了这个问题
试试这个:
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install
对我有用!
参考:
嗯,我在 MacOS Monterey (12.0.1) 上遇到了几乎相同的问题,对我有用的是:
- 从头开始重新安装 CommandLineTools:
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install
- 正在使用 Homebrew 重新安装一些命令行工具:
brew update && brew upgrade && brew reinstall zlib openssl bzip2 readline
- 使用标志配置安装所需的 Python 版本(在本例中为 3.10.0),如下所示:
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 3.10.0
尝试使用 pyenv 2.1.0(来自自制软件)在 MacOS 11.6 (Intel) 上安装 Python 3.10.0 失败:
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.10.0.tar.xz...
-> https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tar.xz
Installing Python-3.10.0...
python-build: use tcl-tk from homebrew
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
BUILD FAILED (OS X 11.6 using python-build 20180424)
Inspect or clean up the working tree at /var/folders/rk/_qysk9hs40qcq14h44l57wch0000gn/T/python-build.20211006114013.40649
Results logged to /var/folders/rk/_qysk9hs40qcq14h44l57wch0000gn/T/python-build.20211006114013.40649.log
Last 10 log lines:
checking MACHDEP... "darwin"
checking for gcc... clang
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... configure: error: in `/var/folders/rk/_qysk9hs40qcq14h44l57wch0000gn/T/python-build.20211006114013.40649/Python-3.10.0':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
make: *** No targets specified and no makefile found. Stop.
构建文件夹中的 config.log 包含:
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by python configure 3.10, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ ./configure --prefix=/Users/jonas.obrist/.pyenv/versions/3.10.0 --libdir=/Users/jonas.obrist/.pyenv/versions/3.10.0/lib --with-openssl=/usr/local/opt/openssl@1.1 --with-tcltk-libs=-L/usr/local/opt/tcl-tk/lib -ltcl8.6 -ltk8.6 --with-tcltk-includes=-I/usr/local/opt/tcl-tk/include
## --------- ##
## Platform. ##
## --------- ##
hostname = Jonas-MBP-2018.local
uname -m = x86_64
uname -r = 20.6.0
uname -s = Darwin
uname -v = Darwin Kernel Version 20.6.0: Mon Aug 30 06:12:21 PDT 2021; root:xnu-7195.141.6~3/RELEASE_X86_64
/usr/bin/uname -p = i386
/bin/uname -X = unknown
/bin/arch = unknown
/usr/bin/arch -k = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo = Mach kernel version:
Darwin Kernel Version 20.6.0: Mon Aug 30 06:12:21 PDT 2021; root:xnu-7195.141.6~3/RELEASE_X86_64
Kernel configured for up to 12 processors.
6 processors are physically available.
12 processors are logically available.
Processor type: x86_64h (Intel x86-64h Haswell)
Processors active: 0 1 2 3 4 5 6 7 8 9 10 11
Primary memory available: 32.00 gigabytes
Default processor set: 614 tasks, 3158 threads, 12 processors
Load average: 2.13, Mach factor: 9.85
/bin/machine = unknown
/usr/bin/oslevel = unknown
/bin/universe = unknown
PATH: /usr/local/Cellar/pyenv/HEAD-483d95d/libexec
PATH: /usr/local/Cellar/pyenv/HEAD-483d95d/plugins/python-build/bin
PATH: /Users/jonas.obrist/.poetry/bin
PATH: /Users/jonas.obrist/.rbenv/shims
PATH: /usr/local/opt/llvm/bin
PATH: /usr/local/opt/libxml2/bin
PATH: /Users/jonas.obrist/.poetry/bin/
PATH: /Users/jonas.obrist/.cargo/bin
PATH: /Users/jonas.obrist/.local/bin
PATH: /Users/jonas.obrist/.fastlane/bin
PATH: /Users/jonas.obrist/.gem/bin
PATH: /Users/jonas.obrist/.pyenv/shims
PATH: /Users/jonas.obrist/.pyenv/bin
PATH: /usr/local/bin
PATH: /usr/bin
PATH: /bin
PATH: /usr/sbin
PATH: /sbin
PATH: /Library/Apple/usr/bin
PATH: /Users/jonas.obrist/go/bin
## ----------- ##
## Core tests. ##
## ----------- ##
configure:2878: checking build system type
configure:2892: result: x86_64-apple-darwin20.6.0
configure:2912: checking host system type
configure:2925: result: x86_64-apple-darwin20.6.0
configure:2955: checking for python3.10
configure:2971: found /Users/jonas.obrist/.pyenv/shims/python3.10
configure:2982: result: python3.10
configure:3076: checking for --enable-universalsdk
configure:3123: result: no
configure:3147: checking for --with-universal-archs
configure:3162: result: no
configure:3318: checking MACHDEP
configure:3369: result: "darwin"
configure:3653: checking for gcc
configure:3680: result: clang
configure:3909: checking for C compiler version
configure:3918: clang --version >&5
Homebrew clang version 12.0.1
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin
configure:3929: $? = 0
configure:3918: clang -v >&5
Homebrew clang version 12.0.1
Target: x86_64-apple-darwin20.6.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin
configure:3929: $? = 0
configure:3918: clang -V >&5
clang-12: error: argument to '-V' is missing (expected 1 value)
clang-12: error: no input files
configure:3929: $? = 1
configure:3918: clang -qversion >&5
clang-12: error: unknown argument '-qversion'; did you mean '--version'?
clang-12: error: no input files
configure:3929: $? = 1
configure:3949: checking whether the C compiler works
configure:3971: clang -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/Users/jonas.obrist/.pyenv/versions/3.10.0/include -I/usr/local/opt/openssl/include -L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/Users/jonas.obrist/.pyenv/versions/3.10.0/lib -L/usr/local/opt/openssl/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib conftest.c >&5
ld: warning: directory not found for option '-L/Users/jonas.obrist/.pyenv/versions/3.10.0/lib'
configure:3975: $? = 0
configure:4023: result: yes
configure:4026: checking for C compiler default output file name
configure:4028: result: a.out
configure:4034: checking for suffix of executables
configure:4041: clang -o conftest -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/Users/jonas.obrist/.pyenv/versions/3.10.0/include -I/usr/local/opt/openssl/include -L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/Users/jonas.obrist/.pyenv/versions/3.10.0/lib -L/usr/local/opt/openssl/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib conftest.c >&5
ld: warning: directory not found for option '-L/Users/jonas.obrist/.pyenv/versions/3.10.0/lib'
configure:4045: $? = 0
configure:4067: result:
configure:4089: checking whether we are cross compiling
configure:4097: clang -o conftest -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/Users/jonas.obrist/.pyenv/versions/3.10.0/include -I/usr/local/opt/openssl/include -L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/Users/jonas.obrist/.pyenv/versions/3.10.0/lib -L/usr/local/opt/openssl/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib conftest.c >&5
In file included from conftest.c:8:
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:64:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:93:16: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
unsigned char *_base;
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:93:16: note: insert '_Nullable' if the pointer may be null
unsigned char *_base;
^
_Nullable
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:93:16: note: insert '_Nonnull' if the pointer should never be null
unsigned char *_base;
^
_Nonnull
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:138:32: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
int (* _Nullable _read) (void *, char *, int);
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:138:32: note: insert '_Nullable' if the pointer may be null
int (* _Nullable _read) (void *, char *, int);
^
_Nullable
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:138:32: note: insert '_Nonnull' if the pointer should never be null
int (* _Nullable _read) (void *, char *, int);
^
_Nonnull
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:138:40: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
int (* _Nullable _read) (void *, char *, int);
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:138:40: note: insert '_Nullable' if the pointer may be null
int (* _Nullable _read) (void *, char *, int);
^
_Nullable
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:138:40: note: insert '_Nonnull' if the pointer should never be null
int (* _Nullable _read) (void *, char *, int);
^
_Nonnull
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:139:35: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
fpos_t (* _Nullable _seek) (void *, fpos_t, int);
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:139:35: note: insert '_Nullable' if the pointer may be null
fpos_t (* _Nullable _seek) (void *, fpos_t, int);
^
_Nullable
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:139:35: note: insert '_Nonnull' if the pointer should never be null
fpos_t (* _Nullable _seek) (void *, fpos_t, int);
^
_Nonnull
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:140:32: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
int (* _Nullable _write)(void *, const char *, int);
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:140:32: note: insert '_Nullable' if the pointer may be null
int (* _Nullable _write)(void *, const char *, int);
^
_Nullable
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:140:32: note: insert '_Nonnull' if the pointer should never be null
int (* _Nullable _write)(void *, const char *, int);
^
_Nonnull
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:140:46: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
int (* _Nullable _write)(void *, const char *, int);
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:140:46: note: insert '_Nullable' if the pointer may be null
int (* _Nullable _write)(void *, const char *, int);
^
_Nullable
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:140:46: note: insert '_Nonnull' if the pointer should never be null
int (* _Nullable _write)(void *, const char *, int);
^
_Nonnull
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:144:18: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
struct __sFILEX *_extra; /* additions to FILE to not break ABI */
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:144:18: note: insert '_Nullable' if the pointer may be null
struct __sFILEX *_extra; /* additions to FILE to not break ABI */
^
_Nullable
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/_stdio.h:144:18: note: insert '_Nonnull' if the pointer should never be null
struct __sFILEX *_extra; /* additions to FILE to not break ABI */
^
_Nonnull
In file included from conftest.c:8:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:220:5: error: 'TARGET_OS_IPHONE' is not defined, evaluates to 0 [-Werror,-Wundef-prefix=TARGET_OS_]
#if TARGET_OS_IPHONE
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:67:13: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
extern FILE *__stdinp;
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:67:13: note: insert '_Nullable' if the pointer may be null
extern FILE *__stdinp;
^
_Nullable
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:67:13: note: insert '_Nonnull' if the pointer should never be null
extern FILE *__stdinp;
^
_Nonnull
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:386:41: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
int (* _Nullable)(void *, const char *, int),
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:386:41: note: insert '_Nullable' if the pointer may be null
int (* _Nullable)(void *, const char *, int),
^
_Nullable
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:386:41: note: insert '_Nonnull' if the pointer should never be null
int (* _Nullable)(void *, const char *, int),
^
_Nonnull
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:386:55: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
int (* _Nullable)(void *, const char *, int),
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:386:55: note: insert '_Nullable' if the pointer may be null
int (* _Nullable)(void *, const char *, int),
^
_Nullable
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:386:55: note: insert '_Nonnull' if the pointer should never be null
int (* _Nullable)(void *, const char *, int),
^
_Nonnull
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:387:44: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
fpos_t (* _Nullable)(void *, fpos_t, int),
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:387:44: note: insert '_Nullable' if the pointer may be null
fpos_t (* _Nullable)(void *, fpos_t, int),
^
_Nullable
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:387:44: note: insert '_Nonnull' if the pointer should never be null
fpos_t (* _Nullable)(void *, fpos_t, int),
^
_Nonnull
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:388:41: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
int (* _Nullable)(void *));
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:388:41: note: insert '_Nullable' if the pointer may be null
int (* _Nullable)(void *));
^
_Nullable
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:388:41: note: insert '_Nonnull' if the pointer should never be null
int (* _Nullable)(void *));
^
_Nonnull
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:384:6: warning: pointer is missing a nullability type specifier (_Nonnull, _Nullable, or _Null_unspecified) [-Wnullability-completeness]
FILE *funopen(const void *,
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:384:6: note: insert '_Nullable' if the pointer may be null
FILE *funopen(const void *,
^
_Nullable
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdio.h:384:6: note: insert '_Nonnull' if the pointer should never be null
FILE *funopen(const void *,
^
_Nonnull
13 warnings and 1 error generated.
configure:4101: $? = 1
configure:4108: ./conftest
./configure: line 4110: ./conftest: No such file or directory
configure:4112: $? = 127
configure:4119: error: in `/var/folders/rk/_qysk9hs40qcq14h44l57wch0000gn/T/python-build.20211006114013.40649/Python-3.10.0':
configure:4121: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
## ---------------- ##
## Cache variables. ##
## ---------------- ##
ac_cv_build=x86_64-apple-darwin20.6.0
ac_cv_env_CC_set=set
ac_cv_env_CC_value=clang
ac_cv_env_CFLAGS_set=set
ac_cv_env_CFLAGS_value='-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include '
ac_cv_env_CPPFLAGS_set=set
ac_cv_env_CPPFLAGS_value='-I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/Users/jonas.obrist/.pyenv/versions/3.10.0/include -I/usr/local/opt/openssl/include'
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_LDFLAGS_set=set
ac_cv_env_LDFLAGS_value='-L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/Users/jonas.obrist/.pyenv/versions/3.10.0/lib -L/usr/local/opt/openssl/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib'
ac_cv_env_LIBS_set=
ac_cv_env_LIBS_value=
ac_cv_env_MACHDEP_set=
ac_cv_env_MACHDEP_value=
ac_cv_env_PROFILE_TASK_set=
ac_cv_env_PROFILE_TASK_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_host=x86_64-apple-darwin20.6.0
ac_cv_prog_PYTHON_FOR_REGEN=python3.10
ac_cv_prog_ac_ct_CC=clang
## ----------------- ##
## Output variables. ##
## ----------------- ##
ABIFLAGS=''
ALT_SOABI=''
AR=''
ARCH_RUN_32BIT=''
ARFLAGS=''
BASECFLAGS=''
BASECPPFLAGS=''
BINLIBDEST=''
BLDLIBRARY=''
BLDSHARED=''
BUILDEXEEXT=''
CC='clang'
CCSHARED=''
CFLAGS='-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include '
CFLAGSFORSHARED=''
CFLAGS_ALIASING=''
CFLAGS_NODIST=''
CONFIGURE_MACOSX_DEPLOYMENT_TARGET=''
CONFIG_ARGS=' '\''--prefix=/Users/jonas.obrist/.pyenv/versions/3.10.0'\'' '\''--libdir=/Users/jonas.obrist/.pyenv/versions/3.10.0/lib'\'' '\''--with-openssl=/usr/local/opt/openssl@1.1'\'' '\''--with-tcltk-libs=-L/usr/local/opt/tcl-tk/lib -ltcl8.6 -ltk8.6'\'' '\''--with-tcltk-includes=-I/usr/local/opt/tcl-tk/include'\'' '\''CC=clang'\'' '\''CFLAGS=-I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include '\'' '\''LDFLAGS=-L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/Users/jonas.obrist/.pyenv/versions/3.10.0/lib -L/usr/local/opt/openssl/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib'\'' '\''CPPFLAGS=-I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/Users/jonas.obrist/.pyenv/versions/3.10.0/include -I/usr/local/opt/openssl/include'\'''
CPP=''
CPPFLAGS='-I/usr/local/opt/readline/include -I/usr/local/opt/readline/include -I/Users/jonas.obrist/.pyenv/versions/3.10.0/include -I/usr/local/opt/openssl/include'
CXX=''
DEFS=''
DEF_MAKE_ALL_RULE=''
DEF_MAKE_RULE=''
DFLAGS=''
DLINCLDIR=''
DLLLIBRARY=''
DTRACE=''
DTRACE_HEADERS=''
DTRACE_OBJS=''
DYNLOADFILE=''
ECHO_C='\c'
ECHO_N=''
ECHO_T=''
EGREP=''
ENSUREPIP=''
EXEEXT=''
EXPORTSFROM=''
EXPORTSYMS=''
EXPORT_MACOSX_DEPLOYMENT_TARGET='#'
EXT_SUFFIX=''
FRAMEWORKALTINSTALLFIRST=''
FRAMEWORKALTINSTALLLAST=''
FRAMEWORKINSTALLAPPSPREFIX=''
FRAMEWORKINSTALLFIRST=''
FRAMEWORKINSTALLLAST=''
FRAMEWORKPYTHONW=''
FRAMEWORKUNIXTOOLSPREFIX='/Users/jonas.obrist/.pyenv/versions/3.10.0'
GITBRANCH=''
GITTAG=''
GITVERSION=''
GNULD=''
GREP=''
HAS_GIT='no-repository'
HAVE_GETHOSTBYNAME=''
HAVE_GETHOSTBYNAME_R=''
HAVE_GETHOSTBYNAME_R_3_ARG=''
HAVE_GETHOSTBYNAME_R_5_ARG=''
HAVE_GETHOSTBYNAME_R_6_ARG=''
INSTALL_DATA=''
INSTALL_PROGRAM=''
INSTALL_SCRIPT=''
INSTSONAME=''
LDCXXSHARED=''
LDFLAGS='-L/usr/local/opt/readline/lib -L/usr/local/opt/readline/lib -L/Users/jonas.obrist/.pyenv/versions/3.10.0/lib -L/usr/local/opt/openssl/lib -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib'
LDFLAGS_NODIST=''
LDLIBRARY=''
LDLIBRARYDIR=''
LDSHARED=''
LDVERSION=''
LIBC=''
LIBFFI_INCLUDEDIR=''
LIBM=''
LIBOBJS=''
LIBPL=''
LIBPYTHON=''
LIBRARY=''
LIBRARY_DEPS=''
LIBS=''
LIBTOOL_CRUFT=''
LINKCC=''
LINKFORSHARED=''
LIPO_32BIT_FLAGS=''
LIPO_INTEL64_FLAGS=''
LLVM_AR=''
LLVM_AR_FOUND=''
LLVM_PROFDATA=''
LLVM_PROF_ERR=''
LLVM_PROF_FILE=''
LLVM_PROF_FOUND=''
LLVM_PROF_MERGER=''
LN=''
LTLIBOBJS=''
MACHDEP='darwin'
MACHDEP_OBJS=''
MAINCC=''
MKDIR_P=''
MULTIARCH=''
MULTIARCH_CPPFLAGS=''
NO_AS_NEEDED=''
OBJEXT=''
OPENSSL_INCLUDES=''
OPENSSL_LDFLAGS=''
OPENSSL_LIBS=''
OPENSSL_RPATH=''
OPT=''
OTHER_LIBTOOL_OPT=''
PACKAGE_BUGREPORT='https://bugs.python.org/'
PACKAGE_NAME='python'
PACKAGE_STRING='python 3.10'
PACKAGE_TARNAME='python'
PACKAGE_URL=''
PACKAGE_VERSION='3.10'
PATH_SEPARATOR=':'
PGO_PROF_GEN_FLAG=''
PGO_PROF_USE_FLAG=''
PKG_CONFIG=''
PLATFORM_TRIPLET=''
PLATLIBDIR=''
PROFILE_TASK=''
PY3LIBRARY=''
PYTHONFRAMEWORK=''
PYTHONFRAMEWORKDIR='no-framework'
PYTHONFRAMEWORKIDENTIFIER='org.python.python'
PYTHONFRAMEWORKINSTALLDIR=''
PYTHONFRAMEWORKPREFIX=''
PYTHON_FOR_BUILD='./$(BUILDPYTHON) -E'
PYTHON_FOR_REGEN='python3.10'
PY_ENABLE_SHARED=''
READELF=''
RUNSHARED=''
SED=''
SHELL='/bin/sh'
SHLIBS=''
SHLIB_SUFFIX=''
SOABI=''
SOVERSION='1.0'
SRCDIRS=''
STATIC_LIBPYTHON=''
TCLTK_INCLUDES=''
TCLTK_LIBS=''
TEST_MODULES=''
THREADHEADERS=''
TRUE=''
TZPATH=''
UNIVERSALSDK=''
UNIVERSAL_ARCH_FLAGS=''
VERSION='3.10'
WHEEL_PKG_DIR=''
_PYTHON_HOST_PLATFORM=''
ac_ct_AR=''
ac_ct_CC='clang'
ac_ct_CXX=''
ac_ct_READELF=''
bindir='${exec_prefix}/bin'
build='x86_64-apple-darwin20.6.0'
build_alias=''
build_cpu='x86_64'
build_os='darwin20.6.0'
build_vendor='apple'
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='NONE'
host='x86_64-apple-darwin20.6.0'
host_alias=''
host_cpu='x86_64'
host_os='darwin20.6.0'
host_vendor='apple'
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
libdir='/Users/jonas.obrist/.pyenv/versions/3.10.0/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
oldincludedir='/usr/include'
pdfdir='${docdir}'
prefix='/Users/jonas.obrist/.pyenv/versions/3.10.0'
program_transform_name='s,x,x,'
psdir='${docdir}'
runstatedir='${localstatedir}/run'
sbindir='${exec_prefix}/sbin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target_alias=''
## ----------- ##
## confdefs.h. ##
## ----------- ##
/* confdefs.h */
#define _GNU_SOURCE 1
#define _NETBSD_SOURCE 1
#define __BSD_VISIBLE 1
#define _DARWIN_C_SOURCE 1
#define _PYTHONFRAMEWORK ""
configure: exit 1
我可以通过下载 tarball 和 ./configure && make
如何安装它?
尝试env ARCHFLAGS="-arch x86_64"
(这对我适用于其他 Python 相关工具,我自己不使用 pyenv)。
基本原理:现代 macOS 支持 2 种架构:intel (x86_64) 和 m1(arm-something)。仅针对一种架构进行编译更容易。
抱歉,仍然不知道为什么,但我只是尝试了一下,它对我有用(下面的终端输出)。我是 运行 Mac OS Big Sur,版本 11.5.2,配备 Intel i7 处理器。我的pyenv版本也是最新的(2.1.0)
$ pyenv install 3.10.0
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.10.0.tar.xz...
-> https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tar.xz
Installing Python-3.10.0...
python-build: use tcl-tk from homebrew
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
Installed Python-3.10.0 to /Users/myuser/.pyenv/versions/3.10.0
在此之前我做了:
brew update && brew upgrade pyenv
问题是我安装了第二个版本的 clang(通过自制软件),这干扰了构建。在 运行 brew uninstall llvm
pyenv/python-build 从 xcode 中选择了 clang 之后,现在 pyenv 又开始工作了。
我有一个类似的问题,通过将 $CC
环境变量设置为 clang
.
试试这个:
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install
对我有用!
参考:
嗯,我在 MacOS Monterey (12.0.1) 上遇到了几乎相同的问题,对我有用的是:
- 从头开始重新安装 CommandLineTools:
sudo rm -rf /Library/Developer/CommandLineTools
sudo xcode-select --install
- 正在使用 Homebrew 重新安装一些命令行工具:
brew update && brew upgrade && brew reinstall zlib openssl bzip2 readline
- 使用标志配置安装所需的 Python 版本(在本例中为 3.10.0),如下所示:
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 3.10.0