gpt4 book ai didi

python - brew install python - OSX 失败

转载 作者:太空宇宙 更新时间:2023-11-03 18:08:27 24 4
gpt4 key购买 nike

我正在尝试通过 brew 安装 python:

brew install python  

但出现以下错误:

Stevens-MacBook-Pro :: ~ ‹master*› » brew install python
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/python-2.7.
Already downloaded: /Library/Caches/Homebrew/python-2.7.8_2.mountain_lion.bottle.tar.gz
==> Pouring python-2.7.8_2.mountain_lion.bottle.tar.gz
==> Caveats
Setuptools and Pip have been installed. To update them
pip install --upgrade setuptools
pip install --upgrade pip

You can install Python packages with
pip install <package>

They will install into the site-package directory
/usr/local/lib/python2.7/site-packages

See: https://github.com/Homebrew/homebrew/wiki/Homebrew-and-Python

.app bundles were installed.
Run `brew linkapps` to symlink these to /Applications.
/usr/bin/install_name_tool: object: /usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python malformed object (unknown load command 10)
Error: Failed to fix install names
The formula built, but you may encounter issues using it or linking other
formula against it.
==> /usr/local/Cellar/python/2.7.8_2/bin/python -ssetup.py --no-user-cfg instal
using one of the approaches described here:

Please make the appropriate changes for your system and try again.
Warning: The post-install step did not complete successfully
You can try again using `brew postinstall python`
==> Summary
🍺 /usr/local/Cellar/python/2.7.8_2: 4626 files, 73M

错误消息表明安装后失败,并尝试使用以下命令重新安装:

brew postinstall python

但错误仍然存​​在。我还尝试了 brew linkapps ,它成功完全链接了 python,但是当我从控制台运行 pip 时,我收到此错误:

Stevens-MacBook-Pro :: ~ ‹master*› » pip
zsh: /usr/local/bin/pip: bad interpreter: @@HOMEBREW_PREFIX@@/opt/python/bin/python2.7: no such file or directory

知道可能出了什么问题吗?

最佳答案

Pyenv 是一个 Python 版本管理工具,类似于 rbenv,但适用于 Python。

您可以通过 pyenv 轻松安装和更改 python 版本。

下面展示如何通过pyenv安装2.7.8版本的python:

ubuntu@ubuntu:~$ pyenv install 2.7.8
Downloading Python-2.7.8.tgz...
-> http://yyuu.github.io/pythons/74d70b914da4487aa1d97222b29e9554d042f825f26cb2b93abd20fdda56b557
Installing Python-2.7.8...
Installing setuptools from https://bootstrap.pypa.io/ez_setup.py...
Installing pip from https://bootstrap.pypa.io/get-pip.py...
Installed Python-2.7.8 to /home/ubuntu/.pyenv/versions/2.7.8

如您所见,它非常简单。

命令pyenv install "version"可以帮助您轻松安装特定版本的python,甚至pip、setuptools也会自动安装。

我建议给pyenv尝试一下!!

关于python - brew install python - OSX 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26416953/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com