我正在尝试运行 boto 脚本,但出现以下错误:
ImportError: No module named boto.swf.layer2
根据 pip freeze 我已经安装了 boto,所以我想知道这里出了什么问题。
我的Python路径如下:
['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-linux2', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages']
我的boto路径如下:
/usr/lib/python2.7/dist-packages/boto/__init__.pyc
这是否意味着 Python 路径存在某种错误?我真的不知道如何调试这个。
最佳答案
首先我会验证您至少可以导入 boto:
import boto
print boto.__file__
验证它是否位于 /usr/lib/python2.7/dist-packages/boto/__init__.pyc
中。
如果有效,那么我会检查您的 boto 版本:
import boto
print boto.__version__
您尝试导入的特定模块已添加到 2.7.0 中的 boto,因此您至少需要该版本。
关于python - 如何设置Python路径以便找到模块?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18092221/