0

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

HackAfro
  • 720
  • 1
  • 12
  • 28
  • 1
    http://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
  • 1
    Possible 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 Answers1

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