我最近遇到过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.
答案 0 :(得分:2)
要使用brew卸载,请使用此命令brew uninstall <package>
。
Mac OS X预装了python,因此除非必要,否则无需安装其他Python实例。
您可以使用Homebrew运行brew install python
来安装Python。
即使python已预先安装为@jgritty在评论中暗示,您也可以考虑不将其用于开发目的。
所以你应该brew uninstall python
然后brew install python
。
要删除已安装的Python(2.7)实例,您需要在终端中运行以下命令;
sudo rm -rf /Library/Frameworks/Python.framework/Versions/2.7
sudo rm -rf "/Applications/Python 2.7"
删除/usr/local/bin
中指向此python版本的符号链接,请参阅ls -l /usr/local/bin | grep '../Library/Frameworks/Python.framework/Versions/2.7'
如有必要,编辑您的shell配置文件以删除将/Library/Frameworks/Python.framework/Versions/2.7
添加到PATH环境文件中。根据您使用的shell,可能修改了以下任何文件:~/bash_login, ~/bash_profile, ~/cshrc, ~/profile, ~/tcshrc, and/or ~/zprofile
。
@Ned Deily提供的this link引用。
答案 1 :(得分:2)
您可以brew list
查看已安装的brew。
如果python
和python3
不在该列表中,您可能需要安装其中一个或两个。
基于这些文件:
/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安装。