天天看點

在Mac12.5.1上源碼安裝Python3.8.13

源碼安裝是我一直用python的方式,用​

​--prefix=/path/​

​指定安裝路徑後,非常友善。

Step-0,configure時就報錯

解壓源碼包後在裡面執行

​​

​./configure --prefix=/path/​

​​ 報錯:

​error: check config.log and use the '--with-universal-archs'​

Step-1,解決configure時報錯問題

參考:

​​​ https://github.com/pyenv/pyenv/issues/1738​​​ 執行

​​

​sudo rm -rf /Library/Developer/CommandLineTools​

​​

​xcode-select --install​

​ 下面這句可能報錯

​/usr/bin/xcodebuild -version ​

​ 上面這句報錯的話,執行下面這句

​sudo xcode-select --switch /Library/Developer/CommandLineTools​

Step-2,正式安裝

./configure --prefix=/path/ --enable-optimizations

make && make install