pythonmacospythonpath

What is the Folder being referenced in PYTHONPATH?


I need to add a directory to my PYTHONPATH variable based on directions from a project that state the following:

Modify your ~/.bashrc file by adding the following line
export PYTHONPATH=$PYTHONPATH:YourFolder/Dir-Folder/

What would YourFolder be in this case if I am using a mac and Dir-Folder is under Mac-HD/Users/username/Dir-Folder?

When I'm in terminal and I run python then run print(sys.path), Dir-Folder doesn't show up. I currently have it set as:

export PYTHONPATH=$PYTHONPATH:~/Dir-Folder/

Solution

  • You should run source ~/.bashrc command in order to make the changes you made in ~/.bashrc visible immediately.

    You can also consider making the change to ~/.bash_profile instead. Then, you wouldn't have to run the source command over and over again.

    See more: "source" command on mac (stackoverflow.com)