家酿不能正确链接python? [英] Homebrew not linking python correctly?

查看:105
本文介绍了家酿不能正确链接python?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用自制软件安装了python 2.7.13和python 3.6.2,并以如下方式更新了我的〜/.bash_profile:

I installed both python 2.7.13 and python 3.6.2 with homebrew and updated my ~/.bash_profile as such:

# Homebrew
export PATH=/usr/local/bin:$PATH

Python3链接良好.但是,哪个python"仍然会给我

Python3 was linked fine. However, "which python" would still give me

/usr/bin/python

而"python2"产生的是

while "which python2" produces

/usr/local/bin/python2

看起来自制软件将python 2安装为"python2",并且从未将"python"链接到新安装.这在安装virtualenvwrapper等时给我带来很多麻烦.

It looks like homebrew installed python 2 as "python2" and never linked "python" to the new installation. This is causing me a lot of trouble down the road when installing virtualenvwrapper etc.

顺便说一句,我也做了 brew link python.

By the way, I also did brew link python.

有人知道这是为什么以及如何解决?

Anybody know why this is and how to fix it?

非常感谢!

推荐答案

他们更改了该行为

今天我想宣布Homebrew 1.3.0.最重大的变化 因为1.2.0是brew install python不再安装python 无需手动添加PATH的二进制文件,而是安装了python2 二进制的.这避免了默认情况下覆盖系统python二进制文件 在安装Python作为依赖项时.这也为 最终使python为Python 3.x.

Today I’d like to announce Homebrew 1.3.0. The most significant change since 1.2.0 is that brew install python no longer installs a python binary without manual PATH additions and instead installs a python2 binary. This avoids overriding the system python binary by default when installing Python as a dependency. It also paves the way to eventually have python be Python 3.x.

您将必须将python符号链接到所需的自制软件安装的python版本.

You will have to symlink python to the version of python installed by homebrew that you want.

您可以这样做:

$ln -s /usr/local/bin/python2 /usr/local/bin/python

要将python符号链接到自制的Python2.x安装或执行以下操作:

To symlink python to the homebrew Python2.x installation or do:

$ln -s /usr/local/bin/python3 /usr/local/bin/python

将其链接到Python 3.x hombrew安装.

to link it to the Python 3.x hombrew installation.

这篇关于家酿不能正确链接python?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆