python - "Bad"Python安装

标签 python macos config homebrew

我最近遇到了 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 中的符号链接(symbolic link)指向此 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可在this link获得.

关于python - "Bad"Python安装,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28613758/

相关文章:

python - Django DateTimeField 从表单到 UTC

python - 子进程 cp 返回错误 - bufsize 必须是整数

macos - 选择 JDK 时 IntelliJ 挂起

java - 如何为Mac制作可执行文件来运行java命令

python - 读取 python 程序的配置值的最佳方法是什么?引用另一个文件中定义的 Enum 类是否常见?

python - PyGame Conway 的生命游戏,重绘 Sprite

python - 如何将不需要模型的应用程序添加到 django 管理站点?

c - 为什么我在 Ubuntu 上遇到段错误,但在 Mac 上却没有?

java - Spring Java Config期间的加载顺序

nginx - NGINX 配置文件是否有格式化程序/美化器?