I find it easiest to not mess with PYTHONPATH for adding own folders permanently.
The site module offers a method that takes care of adding to sys.path without duplicates and with .pth files.
Make a
The site module offers a method that takes care of adding to sys.path without duplicates and with .pth files.
Make a
sitecustomize.py
file in C:\Python37\Lib\site-packages
or your site-packages folder.# sitecustomize.py import site site.addsitedir(r'E:\div_code')Test that it work.
C:\ λ ptpython >>> import sys >>> from pprint import pprint >>> pprint(sys.path) ['C:\\python37\\Scripts\\ptpython.exe', 'c:\\python37\\python37.zip', 'c:\\python37\\DLLs', 'c:\\python37\\lib', 'c:\\python37', 'c:\\python37\\lib\\site-packages', 'E:\\div_code']For OS and Path look at Python 3.6/3.7 and pip installation under Windows