使用PYTHONPATH的问题

时间:2011-03-16 13:21:11

标签: python pythonpath

我正在尝试使用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

1 个答案:

答案 0 :(得分:3)

尝试

export PYTHONPATH=/home/osqa/EC2/backup/src/

相反,即使用export并删除最后一个路径组件。