我正在尝试使用PYTHONPATH
让Python知道我的库所在的位置,但它似乎忽略了它:
$ PYTHONPATH=/home/osqa/EC2/backup/src/boto/
$ ls /home/osqa/EC2/backup/src/boto/boto/ec2/connection.py
/home/osqa/EC2/backup/src/boto/boto/ec2/connection.py
$ python backup.py
Traceback (most recent call last):
File "backup.py", line 4, in <module>
from boto.ec2.connection import EC2Connection
ImportError: No module named boto.ec2.connection
答案 0 :(得分:3)
尝试
export PYTHONPATH=/home/osqa/EC2/backup/src/
相反,即使用export
并删除最后一个路径组件。