无法加载通过从site

无法加载通过从site

本文介绍了无法加载通过从site-packages目录PIP安装Python模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图安装和使用Evernote的模块(https://github.com/evernote/evernote-sdk-python)我跑了 PIP安装Evernote的和它说,安装工作。

I am trying to install and use the Evernote module (https://github.com/evernote/evernote-sdk-python) . I ran pip install evernote and it says that the installation worked.

我可以证实,Evernote的模块中的 /usr/local/lib/python2.7/site-packages 存在。然而,当我尝试运行蟒蛇-c进口Evernote的我收到以下错误:

I can confirm that the evernote module exists in /usr/local/lib/python2.7/site-packages. However, when I try to run python -c "import evernote" I get the following error:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named evernote

这是我的 .bash知名度的内容:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*

# Setting PATH for Python 3.3
# The orginal version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.3/bin:${PATH}"
export PATH
export PATH=$PATH:/usr/local/bin/

我有与安装PIP 其它模块同样的问题。帮助?

I am having this same problem with other modules installed with pip. Help?

编辑:我是超级新手,没有编辑的 .bash知名度文件。

I am a super newbie and have not edited that .bash-profile file.

编辑:蟒蛇-c'进口SYS;打印\\ n。加入(sys.path中)输出以下内容:

/Library/Python/2.7/site-packages/setuptools-1.3.2-py2.7.egg
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old
/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC
/Library/Python/2.7/site-packages

编辑:我好像加入出口PYTHONPATH =在/ usr / local / lib目录/ python2.7 /站点包,以已经朝着解决取得进展我的的.bash_profile 文件。但是,现在当我运行蟒蛇'从evernote.api.client进口EvernoteClient-c 它试图导入的oauth2,它失败,出现同样的错误。该ouath2模块是模块目录present。

I seemed to have made progress towards a solution by adding export PYTHONPATH="/usr/local/lib/python2.7/site-packages" to my .bash_profile file. However, now when I run python -c 'from evernote.api.client import EvernoteClient' it tries to import oauth2, which fails with the same error. The ouath2 module is present in the module directory.

推荐答案

的/ usr / bin中/ Python的是带有OS X. <$的蟒蛇可执行C $ C>的/ usr / local / lib目录是只可能来自Python.org或家酿用户安装程序的位置。只被安装那么你是混合不同的Python安装,并改变蟒蛇路径不同的软件包的部分解决方法不同的安装。

/usr/bin/python is the executable for the python that comes with OS X. /usr/local/lib is a location for user-installed programs only, possibly from Python.org or Homebrew. So you're mixing different Python installs, and changing the python path is only a partial workaround for different packages being installed for different installations.

为了确保您使用 PIP 与特定的蟒蛇相关联,可以运行蟒蛇-m PIP安装&LT; PKG&GT; ,或者去看看你的路径是什么 PIP 时,或者被链接到。

In order to make sure you use the pip associated with a particular python, you can run python -m pip install <pkg>, or go look at what the pip on your path is, or is symlinked to.

这篇关于无法加载通过从site-packages目录PIP安装Python模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 04:36