Set pythonpath from script at boot time
Hi, under Debian, I need to add some paths to the PYTHONPATH environment variable for all users, including root. I want to do this because I have a custom sh script in /etc/init.d that runs a couple of python scripts needing the new pythonpath. The problem is that whatever I try only alters PYTHONPATH in the context of an open shell. No way to do this during startup.
I've tried exporting the new PYTHONPATH from the sh script as follows: export PYTHONPATH="$PYTHONPATH:/new/path/" and also running a new Python script that calls sys.path.append but nothing works. Thanks in advance for your ideas! |
Hello,
Have a look at a file named site.py in /usr/lib/python<version>/ and in /usr/lib/python<version>/dist-packages. There you'll find the information you need to set / change your PYTHONPATH. More information and clarification can be found here on the Python documentation website. Kind regards, Eric |
All times are GMT -5. The time now is 09:27 AM. |