macOS High Sierra下pyenv安裝多版本失敗問題

chenenkou發表於2019-05-22

macOS下用Python的pyenv工具安轉Python3報如下錯誤:

~ » pyenv install 3.7.0                                                                          
python-build: use openssl from homebrew
python-build: use readline from homebrew
Downloading Python-3.7.0.tar.xz...
-> https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz
Installing Python-3.7.0...
python-build: use readline from homebrew

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

Inspect or clean up the working tree at /var/folders/x0/7hkjnrnj5cd72hbdd_jh_ld40000gn/T/python-build.20190522163929.59157
Results logged to /var/folders/x0/7hkjnrnj5cd72hbdd_jh_ld40000gn/T/python-build.20190522163929.59157.log

Last 10 log lines:
Python/pytime.c:711:13: note: did you mean 'clock_gettime'?
Python/pytime.c:695:11: note: 'clock_gettime' declared here
    err = clock_gettime(CLOCK_REALTIME, &ts);
          ^
Python/pytime.c:711:26: error: use of undeclared identifier 'CLOCK_REALTIME'
        if (clock_getres(CLOCK_REALTIME, &res) == 0) {
                         ^
4 errors generated.
make: *** [Python/pytime.o] Error 1
make: *** Waiting for unfinished jobs....
複製程式碼

解決方案 刪除Command Line Tools工具,重新安裝即可

sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
複製程式碼

相關文章