"Bad" Python 安装

"Bad" Python Install

我最近遇到了 Python 的问题,例如与 anaconda 的兼容性。当我 运行 Homebrew 的 brew doctor 时,我想我遇到了问题,如下所示。我如何擦除这些文件并全新安装 Python?

Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.

Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew provided
script of the same name. We found the following "config" scripts:

    /Library/Frameworks/Python.framework/Versions/3.4/bin/python3-config
    /Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4-config
    /Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4m-config
    /opt/local/bin/curl-config
    /opt/local/bin/freetype-config
    /opt/local/bin/libpng-config
    /opt/local/bin/libpng16-config
    /opt/local/bin/nc-config
    /opt/local/bin/ncurses5-config
    /opt/local/bin/ncursesw5-config
    /opt/local/bin/pcre-config
    /opt/local/bin/python2.7-config
    /opt/local/bin/xml2-config
    /Users/adamg/anaconda/bin/freetype-config
    /Users/adamg/anaconda/bin/libdynd-config
    /Users/adamg/anaconda/bin/libpng-config
    /Users/adamg/anaconda/bin/libpng15-config
    /Users/adamg/anaconda/bin/llvm-config
    /Users/adamg/anaconda/bin/nc-config
    /Users/adamg/anaconda/bin/python-config
    /Users/adamg/anaconda/bin/python2-config
    /Users/adamg/anaconda/bin/python2.7-config
    /Users/adamg/anaconda/bin/xml2-config
    /Users/adamg/anaconda/bin/xslt-config
    /Library/Frameworks/Python.framework/Versions/2.7/bin/python-config
    /Library/Frameworks/Python.framework/Versions/2.7/bin/python2-config
    /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-config

Warning: Python is installed at /Library/Frameworks/Python.framework

Homebrew only supports building against the System-provided Python or a
brewed Python. In particular, Pythons installed to /Library can interfere
with other software installs.

要使用 brew 卸载,请使用此命令 brew uninstall <package>

Mac OS X 已预安装 python,因此除非必要,否则无需安装另一个 Python 实例。

您可以 运行 brew install python 使用 Homebrew 安装 Python。

尽管 python 已预安装,正如评论中提示的 @jgritty 一样,您可能会考虑不要依赖它进行开发。

所以你应该 brew uninstall python 然后 brew install python.

为了删除已安装的 Python (2.7) 实例,您需要在终端中 运行 以下命令;

  1. sudo rm -rf /Library/Frameworks/Python.framework/Versions/2.7

  2. sudo rm -rf "/Applications/Python 2.7"

  3. 删除 /usr/local/bin 中指向此 python 版本的符号链接,请参阅 ls -l /usr/local/bin | grep '../Library/Frameworks/Python.framework/Versions/2.7'

  4. 如有必要,编辑您的 shell 配置文件以删除添加 /Library/Frameworks/Python.framework/Versions/2.7 到您的 PATH 环境文件。根据您使用的 shell,以下任何文件可能已被修改:~/bash_login, ~/bash_profile, ~/cshrc, ~/profile, ~/tcshrc, and/or ~/zprofile.

@Ned Deily available at this link 的引用。

您可以brew list查看 brew 安装了什么。

如果 pythonpython3 不在该列表中,您可能需要安装其中一个或两者。

基于这些文件:

/Library/Frameworks/Python.framework/Versions/3.4/bin/python3-config
/Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4-config
/Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4m-config

我猜你 运行 直接从 python.org 或其他地方下载的 python 3.4 安装。