python 123 io网站答题_brew install python-OSX失败

1586010002-jmsa.png

Im trying to install python through brew with:

brew install python

But get the following error:

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

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

The error messages says the post install fails, and to try installing it again with:

brew postinstall python

but the error still persists. I also tried brew linkapps and it success fully links python but when I run pip from the console I get this error:

Stevens-MacBook-Pro :: ~ ‹master*› » pip

zsh: /usr/local/bin/pip: bad interpreter: @@HOMEBREW_PREFIX@@/opt/python/bin/python2.7: no such file or directory

Any idea what might be going wrong?

解决方案

Pyenv is a python version management tool, something like rbenv but for python.

You could easily install and change python version via pyenv easily.

The following shows how to install python with version 2.7.8 through pyenv:

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

as you can see, its very simple.

The command pyenv install "version" help you to install a specific versions of python easily and even pip, setuptools are also automatically installed.

I suggest giving pyenv a try!!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值