I want to know if it is possible to add the path to a directory to the environment variables permanently using python. I have seen other questions that relate to mine but the answers there only add the path temporarily,I want to know if there's a way to add it permanently
            Asked
            
        
        
            Active
            
        
            Viewed 59 times
        
    0
            
            
        - 
                    1http://unix.stackexchange.com/questions/117467/how-to-permanently-set-environmental-variables This is what you are looking for? – ham Aug 23 '16 at 08:46
- 
                    1Possible duplicate of [How to set environment variables in Python](http://stackoverflow.com/questions/5971312/how-to-set-environment-variables-in-python) – grael Aug 23 '16 at 08:48
- 
                    No, I have a python program that needs marionette driver to run and the path to the driver has to be added to the env variables for it to run. So I want the program to automatically add the path to env variables if it isn't there already. – HackAfro Aug 23 '16 at 08:50
- 
                    Do you mean `PYTHONPATH` (to find python modules) or `PATH` (for executing shell commands)? – Levi Aug 23 '16 at 09:04
- 
                    @Levi PATH for executing shell commands – HackAfro Aug 23 '16 at 09:21
1 Answers
1
            
            
        While using bash add this 
~/.bashrc
export PYTHONPATH="${PYTHONPATH}:/Home/dev/path
Make sure the directory you point to has at the topmost init.py file in your directory structure
 
    
    
        Radhika Jaju
        
- 89
- 1
- 1
- 9
- 
                    1plus1 but just to clarify you need to restart or `source ~/.bashrc` so it will actually take effect – Or Duan Aug 23 '16 at 11:57
- 
                    
