JavaEar 专注于收集分享传播有价值的技术资料

Brew无法安装Python:无法进行符号链接 (Brew fails to install Python: can not symlink)

问题描述


英文原文

I'm trying to install python 2.7 on the latest version of OSX using brew but I get the following error...

.app bundles were installed.
Run `brew linkapps` to symlink these to /Applications.
Warning: Could not link python. Unlinking...
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using `brew link python'

Possible conflicting files are:
/usr/local/bin/pip
/usr/local/bin/easy_install-2.7
/usr/local/bin/easy_install

Would anyone know how to fix this error? I tried brew link python but this did not work. I'm new to Linux/OSX, so if this is really obvious, I would still appreciate it if someone could point me in the right direction!


中文翻译

I'm trying to install python 2.7 on the latest version of OSX using brew but I get the following error...

.app bundles were installed.
Run `brew linkapps` to symlink these to /Applications.
Warning: Could not link python. Unlinking...
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using `brew link python'

Possible conflicting files are:
/usr/local/bin/pip
/usr/local/bin/easy_install-2.7
/usr/local/bin/easy_install

Would anyone know how to fix this error? I tried brew link python but this did not work. I'm new to Linux/OSX, so if this is really obvious, I would still appreciate it if someone could point me in the right direction!

I'm trying to install python 2.7 on the latest version of OSX using brew but I get the following error...

.app bundles were installed.
Run `brew linkapps` to symlink these to /Applications.
Warning: Could not link python. Unlinking...
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using `brew link python'

Possible conflicting files are:
/usr/local/bin/pip
/usr/local/bin/easy_install-2.7
/usr/local/bin/easy_install

Would anyone know how to fix this error? I tried brew link python but this did not work. I'm new to Linux/OSX, so if this is really obvious, I would still appreciate it if someone could point me in the right direction!

I'm trying to install python 2.7 on the latest version of OSX using brew but I get the following error...

.app bundles were installed.
Run `brew linkapps` to symlink these to /Applications.
Warning: Could not link python. Unlinking...
Error: The `brew link` step did not complete successfully
The formula built, but is not symlinked into /usr/local
You can try again using `brew link python'

Possible conflicting files are:
/usr/local/bin/pip
/usr/local/bin/easy_install-2.7
/usr/local/bin/easy_install

Would anyone know how to fix this error? I tried brew link python but this did not work. I'm new to Linux/OSX, so if this is really obvious, I would still appreciate it if someone could point me in the right direction!

2个回答

    最佳答案

  1. 英文原文

    The error means those files already exist in /usr/local/bin

    If you 'ls -lF' on that dir, are they sym links that point to a path with the word 'cellar' in it?

    If so, then brew already put them in place for you. Your are probably missing /usr/local/bin from your PATH

    If not, then something else put them there earlier. On a fresh mac, that directory is empty. Brew is a better way to manage those files, so if it was my machine I would remove those files from /usr/local/bin, then you can run brew link. I'd probably keep them in another spot temporarily in case I later discovered a need for them.

    Also, run 'brew doctor' when you have a chance. It will tell you about any other problems like this.

    Brew wants to own /usr/local/bin. I would let it, it's a great tool.


    中文翻译

    错误表示/ usr / local / bin

    中已存在这些文件

    如果你在那个目录上有-lF',那么它们的sym链接指向一个带有" cellar" 字样的路径吗?

    如果是这样,那么brew已经为你准备好了。您的PATH可能缺少/ usr / local / bin

    如果没有,那么其他东西会把它们放在那里。在一个新的mac上,该目录为空。 Brew是管理这些文件的更好方法,所以如果它是我的机器,我会从/ usr / local / bin中删除这些文件,然后你可以运行brew链接。我可能暂时将它们留在另一个地方,以防我后来发现需要它们。

    此外,如果有机会,请运行'brew doctor'。它会告诉你这样的任何其他问题。

    Brew希望拥有/ usr / local / bin。我会接受它,这是一个很棒的工具。

    The error means those files already exist in /usr/local/bin

    If you 'ls -lF' on that dir, are they sym links that point to a path with the word 'cellar' in it?

    If so, then brew already put them in place for you. Your are probably missing /usr/local/bin from your PATH

    If not, then something else put them there earlier. On a fresh mac, that directory is empty. Brew is a better way to manage those files, so if it was my machine I would remove those files from /usr/local/bin, then you can run brew link. I'd probably keep them in another spot temporarily in case I later discovered a need for them.

    Also, run 'brew doctor' when you have a chance. It will tell you about any other problems like this.

    Brew wants to own /usr/local/bin. I would let it, it's a great tool.

    错误表示/ usr / local / bin

    中已存在这些文件

    如果你在那个目录上有-lF',那么它们的sym链接指向一个带有" cellar" 字样的路径吗?

    如果是这样,那么brew已经为你准备好了。您的PATH可能缺少/ usr / local / bin

    如果没有,那么其他东西会把它们放在那里。在一个新的mac上,该目录为空。 Brew是管理这些文件的更好方法,所以如果它是我的机器,我会从/ usr / local / bin中删除这些文件,然后你可以运行brew链接。我可能暂时将它们留在另一个地方,以防我后来发现需要它们。

    此外,如果有机会,请运行'brew doctor'。它会告诉你这样的任何其他问题。

    Brew希望拥有/ usr / local / bin。我会接受它,这是一个很棒的工具。

  2. 参考答案2

  3. 英文原文

    The most likely answer is that you have somehow installed executables (notably pip and easy-install) that Homebrew packages with it's install of Python outside of the Homebrew workflow. Because Homebrew is not managing these executables (that is, the executables are not symlinks to the versions stored in Homebrew's Cellar repository), its default action is to not overwrite these executables. There are two options you have to resolve this:

    1. You can remove the files that are blocking the installation. Depending on how you installed the executables previously, you might have to do this through manual rm commands. Once you do that, you can run brew link python and Homebrew will happily form the symlinks now that there are no pre-existing executables.

    2. You can tell Homebrew you don't actually care that those executables exist, and you want to overwrite them anyways by using brew link --overwrite python as described in this answer.

    In either case, be aware that both pip and easy-install will have dependency files in a site-packages folder somewhere on your computer from their original installation. It would be advisable for you to audit your Python install and your computer for extraneous site-packages folders.


    中文翻译

    The most likely answer is that you have somehow installed executables (notably pip and easy-install) that Homebrew packages with it's install of Python outside of the Homebrew workflow. Because Homebrew is not managing these executables (that is, the executables are not symlinks to the versions stored in Homebrew's Cellar repository), its default action is to not overwrite these executables. There are two options you have to resolve this:

    1. You can remove the files that are blocking the installation. Depending on how you installed the executables previously, you might have to do this through manual rm commands. Once you do that, you can run brew link python and Homebrew will happily form the symlinks now that there are no pre-existing executables.

    2. You can tell Homebrew you don't actually care that those executables exist, and you want to overwrite them anyways by using brew link --overwrite python as described in this answer.

    In either case, be aware that both pip and easy-install will have dependency files in a site-packages folder somewhere on your computer from their original installation. It would be advisable for you to audit your Python install and your computer for extraneous site-packages folders.