Modifications to sys.path only apply for the life of that Python interpreter. If you want to do it permanently you need to modify the PYTHONPATH environment variable:
PYTHONPATH="/Me/Documents/mydir:$PYTHONPATH"
export PYTHONPATH
Note that PATH is the system path for executables, which is completely separate.
**You can write the above in ~/.bash_profile and the source it using source ~/.bash_profile
Modifications to sys.path only apply for the life of that Python interpreter. If you want to do it permanently you need to modify the PYTHONPATH environment variable:
PYTHONPATH="/Me/Documents/mydir:$PYTHONPATH"
export PYTHONPATH
Note that PATH is the system path for executables, which is completely separate.
**You can write the above in ~/.bash_profile and the source it using source ~/.bash_profile
On MAC OS you can simply find the location of python/python3 by using the command which python or which python3. (works for Linux too)
And it should give something like:
For python
/usr/local/bin/python
For python3
/Library/Frameworks/Python.framework/Versions/3.9/bin/python3
Export the path to your bash_profile
In your terminal type
sudo nano ~/.bash_profile
Enter your password and paste the following lines
PYTHONPATH="/Library/Frameworks/Python.framework/Versions/3.9/bin/python3"
export PYTHONPATH
Press control + x to exit, and press y for saving on being asked to save
Press `enter' to return to terminal window
Source it using the following command in terminal, run
source ~/.bash_profile
Path to python3 should be updated now!!