我正在尝试安装和使用Evernote模块(https://github.com/evernote/evernote-sdk- python)。我跑了pip install evernote,说安装成功了。
pip install evernote
我可以确认Evernote模块存在于中/usr/local/lib/python2.7/site- packages。但是,当我尝试运行时,出现python -c "import evernote"以下错误:
/usr/local/lib/python2.7/site- packages
python -c "import evernote"
Traceback (most recent call last): File "<string>", line 1, in <module> ImportError: No module named evernote
这是我的内容.bash-profile:
.bash-profile
[[ -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。救命?
pip
编辑:我是一个超级新手,还没有编辑该.bash-profile文件。
编辑:python -c 'import sys; print "\n".join(sys.path)'输出以下内容:
python -c 'import sys; print "\n".join(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
编辑: 通过添加export PYTHONPATH=“/usr/local/lib/python2.7/site- packages”到我的.bash_profile文件,我似乎已经在解决方案方面取得了进展。但是,现在,当我运行python -c 'from evernote.api.client import EvernoteClient'它时,它尝试导入oauth2,但失败,并显示相同的错误。ouath2模块位于模块目录中。
export PYTHONPATH=“/usr/local/lib/python2.7/site- packages”
.bash_profile
python -c 'from evernote.api.client import EvernoteClient'
/usr/bin/python是OS X随附的python的可执行文件。/usr/local/lib是仅用于用户安装程序的位置,可能是来自Python.org或Homebrew的位置。因此,您要混合使用不同的Python安装,对于为不同的安装而安装的不同软件包,更改python路径只是部分解决方法。
/usr/bin/python
/usr/local/lib
为了确保您使用pip与特定python相关联的代码,可以运行python -m pip install <pkg>,或查看pip路径上的符号或链接到的符号。
python -m pip install <pkg>