In one windows distribution in the following file:
<python_root_installation_directory>/python38._pth
there are the following lines:
python38.zip
.
./lib
./lib/site-packages
# Uncomment to run site.main() automatically
#import site
Thus, with this content there the following yields:
Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64 bit (AMD64)] on win32
>>> import sys
>>> sys.path
['C:\\Program Files\\Applications\\python_3_8_2\\python38.zip', 'C:\\Program Files\\Applications\\python_3_8_2', 'C:\\Program Files\\Applications\\python_3_8_2\\./lib', 'C:\\Program Files\\Applications\\python_3_8_2\\./lib/site-packages']
So After adding this line into the file: ./lib/site-packages/win32ctypes
it is present in the path:
Python 3.8.2 (tags/v3.8.2:7b3ab59, Feb 25 2020, 23:03:10) [MSC v.1916 64 bit (AMD64)] on win32
>>> import sys
>>> sys.path
['C:\\Program Files\\Applications\\python_3_8_2\\python38.zip', 'C:\\Program Files\\Applications\\python_3_8_2', 'C:\\Program Files\\Applications\\python_3_8_2\\./lib', 'C:\\Program Files\\Applications\\python_3_8_2\\./lib/site-packages', 'C:\\Program Files\\Applications\\python_3_8_2\\./lib/site-packages/win32ctypes']
This way, you don't need to have PYTHONPATH
variable present on the system and you can still have the functionality. Disadvantage would be that this is installation specific, so if you have 3 different distributions on your system, this will affect only the chosen installation, while PYTHONPATH
will affect all of them simultaneously.
sys.path.append()
accepts a directory containing file AND NOT SINGLE PATH TO A FILE. – DecklePYTHONPATH
. – Liebermann