简体   繁体   English

在 macOS 12.3 Monterey 上安装 Python 3.8.10 时出现问题

[英]Issues installing Python 3.8.10 on macOS 12.3 Monterey

Anyone having issues installing python 3.8.10 on macOS Monterey M1 Mac?有人在 macOS Monterey M1 Mac 上安装 python 3.8.10 时遇到问题吗? Any version I try to install using pyenv install gives me this error:我尝试使用pyenv install的任何版本都会给我这个错误:

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 using python-build 20180424)

Inspect or clean up the working tree at /var/folders/yg/s2w3pfj172v6kdwx7hvmq65m0000gn/T/python-build.20220322155830.88129 Results logged to /var/folders/yg/s2w3pfj172v6kdwx7hvmq65m0000gn/T/python-build.20220322155830.88129.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.

I've tried almost all questions across Google Search without success =(. I've tried to install using asdf python plugin and pyenv.我在 Google 搜索中尝试了几乎所有问题,但都没有成功 =(。我尝试使用asdf python plugin and pyenv.

This worked for me.这对我有用。

Install gcc first;先安装gcc;

brew install gcc

And then with gcc run pyenv installation.然后用 gcc 运行 pyenv 安装。

CC=/opt/homebrew/bin/gcc-11 pyenv install 3.8.10

在此处输入图像描述

Apple introduced a change that resulted in its breaking. Apple 引入了一项导致其崩溃的更改。

In your specific case pyenv install 3.8.13 should work.在您的特定情况下pyenv install 3.8.13应该可以工作。

For others on different versions should check this thread对于不同版本的其他人应该检查这个线程

Or use any of these versions 3.7.13, 3.8.13, 3.9.11 and 3.10.3或使用任何这些版本 3.7.13、3.8.13、3.9.11 和 3.10.3

brew install gcc && CC=`which gcc-11` pyenv install 3.8.10

It doesn't need to install gcc with brew !它不需要用brew安装gcc It might fall you in trouble much more!它可能会让你陷入更多麻烦!

There is a bundled gcc in Apple Command Line Tools which you can find it through below command: Apple Command Line Tools中有一个捆绑的gcc ,您可以通过以下命令找到它:

which gcc

Be careful to don't add any version specific number to gcc !注意不要在gcc中添加任何版本特定编号! something like gcc-11 or gcc-12 and so etc. Then check the found gcc is located under /Library/Developer/CommandLineTools/ directory.gcc-11gcc-12等等。然后检查找到的gcc位于/Library/Developer/CommandLineTools/目录下。 The desired output would be something like this:所需的 output 将是这样的:

$ which gcc
/Library/Developer/CommandLineTools/usr/bin/gcc

If everything is Ok, mean you run simple which gcc command and it found gcc and the found path is under /Library/Developer/CommandLineTools/ directory, you can install your python through pyenv using following command:如果一切正常,意味着您运行简单which gcc命令并找到gcc并且找到的路径位于/Library/Developer/CommandLineTools/目录下,您可以使用以下命令安装pyenv

CC=`which gcc` pyenv install 3.8.6

you can install any version of python which is available and you need.您可以安装任何可用且您需要的 python 版本。

If you faced to any issue please comment it, it might help us to make answer more clear and helpful to you.如果您遇到任何问题,请发表评论,这可能有助于我们使答案更加清晰和对您有所帮助。

I faced the same issue.我遇到了同样的问题。 I realized my pyenv version was out of date.我意识到我的 pyenv 版本已经过时了。 I updated it using homebrew by running:我通过运行使用自制软件更新了它:

brew install pyenv

and then running然后运行

pyenv install 3.10.6

worked flawlessly.完美地工作。

Me help as:我帮助:

brew install gcc@11

after:后:

CC=`which gcc-11` pyenv install 3.8.12

I faced the same issue and the solution that worked for me was to install the version manually, here are the steps I performed to get it done:我遇到了同样的问题,对我有用的解决方案是手动安装版本,以下是我为完成它而执行的步骤:

  1. Download the python-3.8.10 version here: https://www.python.org/downloads/release/python-3810/在此处下载 python-3.8.10 版本: https://www.python.org/downloads/release/python-3810/
  2. Once downloaded, double-click to install through the installation wizard.下载后,双击通过安装向导进行安装。
  3. Once completed, from finder or terminal open the directory where it got installed: /Applications/Python 3.8完成后,从 finder 或终端打开安装目录: /Applications/Python 3.8
  4. Run the Install Certificates.command , wait until it completes.运行Install Certificates.command ,等待它完成。
  5. In the same path, run Update Shell Profile.command在同一路径中,运行Update Shell Profile.command
  6. You are all set, to validate it run from the terminal: python3 --version你已经准备好了,验证它从终端运行: python3 --version

To setup a virtual environment for python version 3.8.10 installed manually:要为手动安装的 python 版本 3.8.10 设置虚拟环境:

  1. pip install --upgrade pip
  2. pip install virtualenv
  3. cd my_project_folder/
  4. virtualenv venv
  5. source venv/bin/activate
  6. To deactivate once finish working, run: deactivate要在完成工作后停用,请运行: deactivate

You can get more information about setting up the virtual environment here: https://virtualenv.pypa.io/en/latest/user_guide.html#您可以在此处获取有关设置虚拟环境的更多信息: https://virtualenv.pypa.io/en/latest/user_guide.html#

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Firebase Android 资源生成错误 Firebase Unity SDK 由于 Python 2.7 在 macOS 12.3 Monterey 中被删除 - Firebase Android resource generation error in Firebase Unity SDK due to Python 2.7 being removed in macOS 12.3 Monterey 在 macOS Monterey 12.4 上安装 Python GTK+ - 未找到模块 - Installing Python GTK+ on macOS Monterey 12.4 - Module Not Found 无法在 macOS Monterey 12.3 上安装 psycopg2-binary - Can't install psycopg2-binary on macOS Monterey 12.3 在 Spyder 5.3 Python 3.8.10 中安装 Pipetorch - Installing Pipetorch in Spyder 5.3 Python 3.8.10 如何修复“zsh:找不到命令:python”错误? (macOS Monterey 12.3、Python 3.10、Atom IDE 和 atom-python-run 0.9.7) - How can I fix the "zsh: command not found: python" error? (macOS Monterey 12.3, Python&nbsp;3.10, Atom IDE, and atom-python-run 0.9.7) MacOs Monterey Python3 默认 - MacOs Monterey Python3 as default Python 乌龟图形在 MacOS Mojave 12.3 上不工作 - Python turtle graphics are not working on MacOS Mojave 12.3 在macOS High Sierra上使用Python 3安装OpenCV的问题 - Issues installing OpenCV with Python 3 on macOS High Sierra 使用Python3安装lxml的问题(MacOS) - Issues with installing lxml with Python3 (MacOS) 如何在 macOS 12.3+ 上安装 Python 2 - How to install Python 2 on macOS 12.3+
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM