在MacOS Monterey12.3 使用pyenv安裝問題

若尚未安裝pyenv,請參考:
安裝pyenv參考連結
在MacOS Monterey12.3下
安裝完pyenv後需要安裝python,輸入安裝語法
pyenv install 3.8.10
會出現下圖錯誤訊息:
willseed@MacBook ~ % pyenv install 3.8.10
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.8.10.tar.xz...
-> https://www.python.org/ftp/python/3.8.10/Python-3.8.10.tar.xz
Installing Python-3.8.10...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk

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

Inspect or clean up the working tree at /var/folders/0z/273cbnf57qqcwkvfbs595g700000gn/T/python-build.20220404091453.28759
Results logged to /var/folders/0z/273cbnf57qqcwkvfbs595g700000gn/T/python-build.20220404091453.28759.log

Last 10 log lines:
checking for --with-cxx-main=... no
checking for clang++... no
configure:

  By default, distutils will build C++ extension modules with "clang++".
  If this is not intended, then set CXX on the configure command line.
  
checking for the platform triplet based on compiler characteristics... darwin
configure: error: internal configure error for the platform triplet, please file a bug report
make: *** No targets specified and no makefile found.  Stop.
willseed@MacBook ~ %
以為是我安裝的套件不完整還是,仔細看了上述敘述後,發現

checking for clang++... no

checking for clang++... no

checking for clang++... no

於是在stackoverflow找到相關問題的解法:
參考連結 因為我還沒安裝gcc套件,所以先執行安裝gcc套件指令
brew install gcc
再用
CC=/opt/homebrew/bin/gcc-11 pyenv install 3.8.10
即可安裝成功
安裝完成圖例:

留言

這個網誌中的熱門文章

C++ Forms 預設TextBox 全形 轉半形 問題

dataGirdview 顯示與抓資料