修复多个python安装



看起来我有多个python安装,这使得事情变得困难-例如,pip会告诉我通过pip freeze安装了一个包,但当试图在程序中使用它时,我得到一个错误,它不存在。以下是我运行过的一些诊断测试:

>>> import sys 
>>> sys.executable
'/usr/local/opt/python/bin/python2.7'
>>> sys.exec_prefix
'/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7'
>>> print 'n'.join(sys.path)
/usr/local/lib/python2.7/site-packages/setuptools-15.2-py2.7.egg
/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python27.zip
/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7
/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin
/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac
/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages
/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk
/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old
/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload
/usr/local/lib/python2.7/site-packages
/Library/Python/2.7/site-packages/ipython-2.1.0-py2.7.egg
/Library/Python/2.7/site-packages/gnureadline-6.3.3-py2.7-macosx-10.9-intel.egg
/Library/Python/2.7/site-packages/pip-6.1.1-py2.7.egg
/Library/Python/2.7/site-packages

以及检查python和一些常用工具的路径:

which easy_install
/usr/local/bin/easy_install
which python
/usr/local/bin/python
which pip
/usr/local/bin/pip

我怎么能解决它,做一个干净的重新安装OS X吗?

编辑添加$PATH和.bashrc info:

我的$PATH如下:

Users/me/workspace/google-cloud-sdk/bin:/usr/local/bin:/Users/me/workspace/google-cloud-sdk/bin:/urs/local/bin:/Users/me/workspace/google-cloud-sdk/bin:/urs/local/bin:/Users/me/workspace/google-cloud-sdk/bin:usr/local/python:usr/bin/python:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/texbin: No such file or directory

——它返回一个错误的事实使我怀疑我在某种程度上设置了错误的.bash_profile。这些是我所做的唯一修改:

#Set architecture flags
export ARCHFLAGS="-arch x86_64"
#Ensure user-installed binaries take precedence
export PATH=/usr/local/bin:$PATH
#Load .bashrc if it exists
test -f ~/.bashrc && source ~/.bashrc
# The next line updates PATH for the Google Cloud SDK.
source '/Users/me/workspace/google-cloud-sdk/path.bash.inc'
# The next line enables bash completion for gcloud.
source '/Users/me/workspace/google-cloud-sdk/completion.bash.inc' 
这是我的。bashrc:
# pip should only run if there is a virtualenv currently activated
export PIP_REQUIRE_VIRTUALENV=true
# cache pip-installed packages to avoid re-downloading
export PIP_DOWNLOAD_CACHE=$HOME/.pip/cache

无法找到修复它的方法,所以最终做了一个干净的操作系统安装和设置一个新的python开发环境。

相关内容

  • 没有找到相关文章

最新更新