开发者

PYTHONPATH missing from environment

开发者 https://www.devze.com 2023-02-10 00:13 出处:网络
Please help me understand this. Here you can see that I have PYTHONPATH set (it\'s from my .bashrc) jean@klippie:~$ echo $PYTHONPATH

Please help me understand this. Here you can see that I have PYTHONPATH set (it's from my .bashrc)

jean@klippie:~$ echo $PYTHONPATH 
:/home/jean/local/lib/python2.6/site-packages

But if I try to launch something in my local site-packages it is ignored:

jean@klippie:~$ gtimelog
Traceback (most recent call last):
  File "/home/jean/bin/gtimelog", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 2671, in <module>
    working_set.require(__requires__)
  File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 654, in require
    needed = self.resolve(parse_requirements(requirements))
  File "/usr/lib/python2.6/dist-packages/pkg_resources.py", line 552, in resolve
    raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: gtimelog==0.5.0

Now if I man开发者_如何学Pythonually export PYTHONPATH to exactly the value echo showed me above, it is NOT ignored:

jean@klippie:~$ export PYTHONPATH=:/home/jean/local/lib/python2.6/site-packages
jean@klippie:~$ gtimelog
# SUCCESS

Any clue what's going wrong?


Most probably, you only set the shell variable PYTHONPATH in your .bashrc, but you don't export this variable to the environment. Printing via echo only shows that the shell variable has the printed value. Try

env | grep PYTHONPATH

to query if PYTHONPATH is really in the environment and make sure you really export it in your .bashrc.

0

精彩评论

暂无评论...
验证码 换一张
取 消