简体   繁体   中英

How to install a different version of Python on macOS Monterey

I need to run python 3.6 but have 3.9 on my mac, which is running Monterey.

pyenv install 3.6.9

but i am getting these errors;

python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.6.9.tar.xz...
-> https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tar.xz
Installing Python-3.6.9...
python-build: use tcl-tk from homebrew
python-build: use readline from homebrew
python-build: use zlib from xcode sdk

BUILD FAILED (OS X 12.3 using python-build 2.2.5-1-ga157725d)

Inspect or clean up the working tree at /var/folders/k1/jjq8zhm90z5by3s9rgzrr5p40000gn/T/python-build.20220317113524.63390
Results logged to /var/folders/k1/jjq8zhm90z5by3s9rgzrr5p40000gn/T/python-build.20220317113524.63390.log

Last 10 log lines:
checking for --with-cxx-main=<compiler>... 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.

Additionally, I have also installed xcode command line tools.

Actually the thing you tried works on windows 8 and forward, but for macos monterey go to python.org and then download the version you need. you may get errors if you are using monterey 11.3 and above, so uninstall and dowload the other version. on macos the pyenv is not supported to do all these functions, the error

python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.6.9.tar.xz...
-> https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tar.xz
Installing Python-3.6.9...
python-build: use tcl-tk from homebrew
python-build: use readline from homebrew
python-build: use zlib from xcode sdk

BUILD FAILED (OS X 12.3 using python-build 2.2.5-1-ga157725d)

Inspect or clean up the working tree at /var/folders/k1/jjq8zhm90z5by3s9rgzrr5p40000gn/T/python-build.20220317113524.63390
Results logged to /var/folders/k1/jjq8zhm90z5by3s9rgzrr5p40000gn/T/python-build.20220317113524.63390.log

Last 10 log lines:
checking for --with-cxx-main=<compiler>... 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.

is because the pyenv cannot open the openssl@1.1 but can open openssl@1.0 so dowload that and use it. as this is not able to connect to the server

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM