我通过pyenv安装python 3.7.2
pyenv install 3.7.2
python-build: use openssl from homebrew
python-build: use readline from homebrew
Downloading Python-3.7.2.tar.xz...
-> https://www.python.org/ftp/python/3.7.2/Python-3.7.2.tar.xz
Installing Python-3.7.2...
python-build: use readline from homebrew
BUILD FAILED (OS X 10.14.2 using python-build 20180424)
Inspect or clean up the working tree at /var/folders/ql/l7pj2ssj7j3ctsx3lqt99cwc0000gn/T/python-build.20190129200315.73913
Results logged to /var/folders/ql/l7pj2ssj7j3ctsx3lqt99cwc0000gn/T/python-build.20190129200315.73913.log
Last 10 log lines:
fi
Could not find platform independent libraries <prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: initfsencoding: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'
Current thread 0x0000000111ac65c0 (most recent call first):
/bin/sh: line 1: 85109 Abort trap: 6 ./python.exe -E -S -m sysconfig --generate-posix-vars
generate-posix-vars failed
make: *** [pybuilddir.txt] Error 1
从源代码手动构建时出现相同的错误
$ ./configure
$ make
./python.exe -E -S -m sysconfig --generate-posix-vars ;\
if test $? -ne 0 ; then \
echo "generate-posix-vars failed" ; \
rm -f ./pybuilddir.txt ; \
exit 1 ; \
fi
Could not find platform independent libraries <prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Fatal Python error: initfsencoding: unable to load the file system codec
ModuleNotFoundError: No module named 'encodings'
Current thread 0x0000000115df55c0 (most recent call first):
/bin/sh: line 1: 43771 Abort trap: 6 ./python.exe -E -S -m sysconfig --generate-posix-vars
generate-posix-vars failed
make: *** [pybuilddir.txt] Error 1
我也有自制软件安装的python2和python3。
并拥有xcode开发人员工具xcode-select -p
/ Library / Developer / CommandLineTools