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

发布于 2025-01-16 15:16:07 字数 1395 浏览 2 评论 0原文

有人在 macOS Monterey M1 Mac 上安装 python 3.8.10 时遇到问题吗?我尝试使用 pyenv install 安装的任何版本都会出现此错误:

python-build: use [email protected] 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.

我已经尝试了 Google 搜索中的几乎所有问题,但没有成功 =(。我尝试使用 asdf python 插件安装,并且pyenv。

Anyone having issues installing python 3.8.10 on macOS Monterey M1 Mac? Any version I try to install using pyenv install gives me this error:

python-build: use [email protected] 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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(8

凉城 2025-01-23 15:16:07

苹果公司推出了一项改变,导致其崩溃。

在您的具体情况下 pyenv install 3.8.13 应该可以工作。

对于不同版本的其他人,应检查 此线程

或使用这些版本 3.7 中的任何一个。 13、3.8.13、3.9.11 和 3.10.3

Apple introduced a change that resulted in its breaking.

In your specific case pyenv install 3.8.13 should work.

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

瀞厅☆埖开 2025-01-23 15:16:07

这对我有用。

先安装gcc;

brew install gcc

然后用 gcc 运行 pyenv 安装。

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

输入图像描述这里

This worked for me.

Install gcc first;

brew install gcc

And then with gcc run pyenv installation.

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

enter image description here

樱&纷飞 2025-01-23 15:16:07
brew install gcc && CC=`which gcc-11` pyenv install 3.8.10
brew install gcc && CC=`which gcc-11` pyenv install 3.8.10
滥情稳全场 2025-01-23 15:16:07

它不需要使用 brew 安装 gcc!可能会给你带来更多的麻烦!

Apple Command Line Tools 中有一个捆绑的 gcc,您可以通过以下命令找到它:

which gcc

注意不要向 gcc< 添加任何版本特定编号< /代码>!类似 gcc-11 或 gcc-12 等等。
然后检查发现gcc位于/Library/Developer/CommandLineTools/目录下。所需的输出将是这样的:

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

如果一切正常,意味着您运行简单的 which gcc 命令,它找到了 gcc 并且找到的路径位于 /Library 下/Developer/CommandLineTools/ 目录中,您可以使用以下命令通过 pyenv 安装 Python:

CC=`which gcc` pyenv install 3.8.6

您可以安装任何可用且需要的 Python 版本。

如果您遇到任何问题,请发表评论,这可能有助于我们使答案更清晰,对您有帮助。

It doesn't need to install gcc with brew! 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:

which gcc

Be careful to don't add any version specific number to gcc! something like gcc-11 or gcc-12 and so etc.
Then check the found gcc is located under /Library/Developer/CommandLineTools/ directory. The desired output would be something like this:

$ 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:

CC=`which gcc` pyenv install 3.8.6

you can install any version of python which is available and you need.

If you faced to any issue please comment it, it might help us to make answer more clear and helpful to you.

別甾虛僞 2025-01-23 15:16:07

我的帮助是:

brew install gcc@11

之后:

CC=`which gcc-11` pyenv install 3.8.12

Me help as:

brew install gcc@11

after:

CC=`which gcc-11` pyenv install 3.8.12
骷髅 2025-01-23 15:16:07

我遇到了同样的问题。我意识到我的 pyenv 版本已经过时了。我通过运行以下命令使用自制程序更新了它:

brew install pyenv

然后运行

pyenv install 3.10.6

完美地工作。

I faced the same issue. I realized my pyenv version was out of date. I updated it using homebrew by running:

brew install pyenv

and then running

pyenv install 3.10.6

worked flawlessly.

酷到爆炸 2025-01-23 15:16:07

嘿,这个链接确实有帮助:https://developer.apple.com/forums/thread/703557< /a>

如果你通过自制软件安装的话,似乎你可以下载 3.8.13。

Hey this linked really helped: https://developer.apple.com/forums/thread/703557

It seems you can download 3.8.13 fine if you installed it via homebrew.

多彩岁月 2025-01-23 15:16:07

我遇到了同样的问题,对我有用的解决方案是手动安装该版本,以下是我完成此操作所执行的步骤:

  1. 在此处下载 python-3.8.10 版本: https://www.python.org/downloads/release/python-3810/
  2. 下载后,双击即可通过安装向导进行安装。
  3. 完成后,从查找器或终端打开安装目录:/Applications/Python 3.8
  4. 运行Install Certificates.command,等待其完成。
  5. 在同一路径中,运行 Update Shell Profile.command
  6. 一切就绪,验证它从终端运行:python3 --version

为 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. 要在完成工作后停用,请运行:deactivate

您可以在此处获取有关设置虚拟环境的更多信息:https://virtualenv.pypa.io/en/latest/user_guide.html#

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/
  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
  4. Run the Install Certificates.command, wait until it completes.
  5. In the same path, run Update Shell Profile.command
  6. You are all set, to validate it run from the terminal: python3 --version

To setup a virtual environment for python version 3.8.10 installed manually:

  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

You can get more information about setting up the virtual environment here: https://virtualenv.pypa.io/en/latest/user_guide.html#

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文