我有以下主管配置
[program:do_thing]
command = python -u stuff/do_thing.py
directory = /home/ubuntu/code/processing
environment = PYTHONPATH="$PYTHONPATH:/home/ubuntu/code/utils/"
stdout_logfile = /mnt/log/do_thing.log
redirect_stderr = true
问题是/home/ubuntu/code/utils/
没有根据 sys.path 包含在我的 PYTHONPATH 中(而且我无法从那里导入模块)。Sys.path 显示所有正确的路径,除了这个额外的路径。我已经尝试将它添加到我自己和 root 用户的 .bashrc 中,但他们没有被主管接收。
对于主管没有正确更新环境变量,我做错了什么?您需要更多信息吗?谢谢!
我也注意到了:在 ubuntu 用户中, sys.path 是
['', '/home/ubuntu/code/processing', '/home/ubuntu/code/utils', '/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', '/usr/lib/pymodules/python2.7']
当在主管内部调用时,它是:
['/home/ubuntu/code/processing/stuff', '/', '/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', '/usr/lib/pymodules/python2.7']
请注意主管 sys.path 中如何有一个“/”条目?那个是从哪里来的?