IOError:无效的 Python 安装.../config/Makefile(没有此文件或目录)

IOError:无效的 Python 安装.../config/Makefile(没有此文件或目录)

从 OS X 10.8.3 更新到 10.8.5 和 XCode 后,我的 Python 安装停止工作。这是我尝试执行 Python 时的输出。

Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 563, in <module>
main()
  File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 545, in main
known_paths = addusersitepackages(known_paths)
  File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 278, in addusersitepackages
user_site = getusersitepackages()
  File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 253, in getusersitepackages
user_base = getuserbase() # this will also set USER_BASE
  File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site.py", line 243, in getuserbase
USER_BASE = get_config_var('userbase')
  File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 521, in get_config_var
return get_config_vars().get(name)
  File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 420, in get_config_vars
_init_posix(_CONFIG_VARS)
  File "/usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sysconfig.py", line 288, in _init_posix
raise IOError(msg)
IOError: invalid Python installation: unable to open /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/Makefile (No such file or directory)

我单独安装了 python(不是 OS X 自带的那个),希望使用该安装,如何修复这个问题?我设置了一堆虚拟环境,不知道重新安装 python 是否会破坏它,所以我犹豫着是否要重新安装 python。

答案1

正如 Martijn 所建议的

brew uninstall python

问题是 homebrew 安装了 python 并弄乱了我的路径。

相关内容