You are here because you are using:

  1. Windows OS version 10+
  2. Python version 3.3+
  3. Anaconda3

And you would like to edit your PYTHONPATH permanently.


  1. Go to C:\Users\<your_username>\Anaconda3\Lib\site-packages
  2. Create a file python37.pth
  3. Edit the file to include this line C:\\Users\\<your_username>\\my_module

The Long version; Do Read


In most cases, editing the PYTHONPATH from the Settings GUI will do the trick. The trick is well explained in this Stack Overflow answer.
If in the first place you are only looking to edit your path locally, this helpful answer will do.

Slightly Extended Item no. 1

If you don’t have C:\Users\<your_username>\Anaconda3\Lib\site-packages, replace C:\Users\<your_username> with the path to your Anaconda3.

Slightly Extended Item no. 2

If you are using Python3.7, create a file called python37.pth. Else create a file called python<XX&gt;.pth for whatever Python version you are using.

  • Not sure which version?
    Under C:\Users\<your_username>\Anaconda3\ search for a file of the form python&lt;XX&gt;.dll. The <XX> indicates the version number you need for naming your .pth file.
  • Windows is super annoying and won’t let you create a file with a .pth suffix?
    There are such files in the C:\Users\<your_username>\Anaconda3\Lib\site-packages folder. Copy one of them and edit the prefix.
  • Some places say you need to create a ._pth file instead of .pth?
    A ._pth file will completely replace your existing path. While a .pth file will append its content to the path you already have. You can find more information here.

Slightly Extended Item no. 3

Assuming the SuperCoolClass you wish to import is located at
C:\Users\<your_username>\my_project_folder\ .

Then open your newly created python<XX&gt;.pth file with your favorite text editor (please don’t say it’s Vim) and add one line:
Yes, with those annoying double slashes \\ .
No, without quotes "" .

And that’s it.
Now you can import from anywhere, like a normal person:
from my_awesome_file import SuperCoolClass .


Nothing important to add here really.
I just hope my 2 hours of frustration + 1 hour of writing this post saved you some time.
Peace out.