python导出已安装模块_无法加载通过从site-packages目录PIP安装Python模块

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.

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 "", line 1, in

ImportError: No module named evernote

This is the contents of my .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/

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

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

EDIT: python -c 'import sys; print "\n".join(sys.path)' Outputs the following:

/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

EDIT: 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 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.

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值