Try using py -3.9 instead of python. Is D:\python\python36 in your path ?

Answer from undefined on Stack Overflow
๐ŸŒ
Python
docs.python.org โ€บ 3 โ€บ library โ€บ site.html
site โ€” Site-specific configuration hook โ€” Python 3.15.2 documentation
2 weeks ago - Changed in version 3.3: Importing the module used to trigger paths manipulation even when using -S. It starts by constructing up to four directories from a head and a tail part. For the head part, it uses sys.prefix and sys.exec_prefix; empty heads are skipped. For the tail part, it uses the empty string and then lib/site-packages (on Windows) or lib/pythonX.Y[t]/site-packages (on Unix and macOS).
๐ŸŒ
Python.org
discuss.python.org โ€บ python help
Site Packages location - Python Help - Discussions on Python.org
September 30, 2022 - Iโ€™m trying to find the site packages folder to save my modules to. Iโ€™m using Windows 10 Home, I have looked everywhere and canโ€™t find it. Can someone tell me an easy way to get to it?
๐ŸŒ
Python
python.org โ€บ dev โ€บ peps โ€บ pep-0250
PEP 250 -- Using site-packages on Windows | Python.org
March 30, 2001 - Finally, the executable code which implements the Windows installer used by the bdist_wininst command will need changing to use the new location. A separate patch is available for this, currently maintained by Thomas Heller. This change does not preclude packages using the current location -- the change only adds a directory to sys.path, it does not remove anything. Both the current location (sys.prefix) and the new directory (site-packages) are included in sitedirs, so that .pth files will be recognised in either location.
Top answer
1 of 16
1184

There are two types of site-packages directories, global and per user.

  1. Global site-packages ("dist-packages") directories are listed in sys.path when you run:

     python -m site
    

    For a more concise list run getsitepackages from the site module in Python code:

     python -c 'import site; print(site.getsitepackages())'
    

    Caution: In virtual environments getsitepackages is not available with older versions of virtualenv, sys.path from above will list the virtualenv's site-packages directory correctly, though. In Python 3, you may use the sysconfig module instead:

     python3 -c 'import sysconfig; print(sysconfig.get_paths()["purelib"])'
    
  2. The per user site-packages directory (PEP 370) is where Python installs your local packages:

     python -m site --user-site
    

    If this points to a non-existing directory check the exit status of Python and see python -m site --help for explanations.

    Hint: Running pip list --user or pip freeze --user gives you a list of all installed per user site-packages.


Practical Tips

  • <package>.__path__ lets you identify the location(s) of a specific package: (details)

      $ python -c "import setuptools as _; print(_.__path__)"
      ['/usr/lib/python2.7/dist-packages/setuptools']
    
  • <module>.__file__ lets you identify the location of a specific module: (difference)

      $ python3 -c "import os as _; print(_.__file__)"
      /usr/lib/python3.6/os.py
    
  • Run pip show <package> to show Debian-style package information:

      $ pip show pytest
      Name: pytest
      Version: 3.8.2
      Summary: pytest: simple powerful testing with Python
      Home-page: https://docs.pytest.org/en/latest/
      Author: Holger Krekel, Bruno Oliveira, Ronny Pfannschmidt, Floris Bruynooghe, Brianna Laugher, Florian Bruhin and others
      Author-email: None
      License: MIT license
      Location: /home/peter/.local/lib/python3.4/site-packages
      Requires: more-itertools, atomicwrites, setuptools, attrs, pathlib2, six, py, pluggy
    
2 of 16
707
>>> import site; site.getsitepackages()
['/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages']

(or just first item with site.getsitepackages()[0])

๐ŸŒ
Achowdhary
achowdhary.com โ€บ python-site-configuration
Python 3 Site Configuration | Anuradha Chowdhary
May 9, 2022 - On import, it extends sys.path with site-specific names constructed by combining the prefix values sys.prefix and sys.exec_prefix with several suffixes. The prefix values used are saved in the module-level variable PREFIXES for reference later. Under Windows, the suffixes are an empty string and lib/site-packages. For Unix-like platforms, the values are lib/python$version/site-packages (where $version is replaced by the major and minor version number of the interpreter, such as 3.5) and lib/site-python.
๐ŸŒ
Python Module of the Week
pymotw.com โ€บ 2 โ€บ site
site โ€“ Site-wide configuration - Python Module of the Week
The USER_SITE path name is created using the same platform-specific values described above. $ python site_user_base.py Base: /Users/dhellmann/.local Site: /Users/dhellmann/.local/lib/python2.7/site-packages ยท The user base directory can be set through the PYTHONUSERBASE environment variable, and has platform-specific defaults (~/Python$version/site-packages for Windows and ~/.local for non-Windows).
Find elsewhere
๐ŸŒ
YouTube
youtube.com โ€บ corey schafer
Python Tutorial: How to Set the Path and Switch Between Different Versions/Executables (Windows) - YouTube
In this Python Programming Tutorial, we will be learning how to set the PATH environment variable on the Windows Operating Systems.Be one of the first 200 pe...
Published: July 26, 2018
Views: 202K
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ article โ€บ how-to-set-your-python-path-on-windows
How to set your python path on Windows?
March 24, 2026 - Add your directory path to the end of the current value, separating multiple paths with semicolons ? C:\Python39\Lib\site-packages;C:\MyProjects\CustomModules
๐ŸŒ
Readthedocs
cdce8p-python-peps.readthedocs.io โ€บ pep-0250
PEP 250 โ€“ Using site-packages on Windows | peps.python.org
This is to ensure that distutils remains compatible with earlier versions of Python. Finally, the executable code which implements the Windows installer used by the bdist_wininst command will need changing to use the new location. A separate patch is available for this, currently maintained by Thomas Heller. This change does not preclude packages using the current location โ€“ the change only adds a directory to sys.path, it does not remove anything. Both the current location (sys.prefix) and the new directory (site-packages) are included in sitedirs, so that .pth files will be recognised in either location.
๐ŸŒ
YouTube
youtube.com โ€บ watch
How to find the location of Python site-packages directory - YouTube
How to find the location of Python site-packages directory
Published: May 11, 2019
๐ŸŒ
Python Packaging
packaging.python.org โ€บ tutorials โ€บ installing-packages
Installing Packages - Python Packaging User Guide
On Windows you can find the user base binary directory by running py -m site --user-site and replacing site-packages with Scripts. For example, this could return C:\Users\Username\AppData\Roaming\Python36\site-packages so you would need to set your PATH to include C:\Users\Username\AppData...
๐ŸŒ
YouTube
youtube.com โ€บ bytive
How do I find the location of my Python site-packages directory? - YouTube
Thanks for watching this video !Don't forget to drop a like and share it with your friends !Subscribe to the Hackanon's channel for more such interesting vid...
Published: June 29, 2022
Views: 3K
๐ŸŒ
Note.nkmk.me
note.nkmk.me โ€บ home โ€บ python
Check and Add the Module Search Path in Python: sys.path | note.nkmk.me
May 12, 2023 - In Windows, separate multiple paths with a semicolon ;. In the above example, the directory '/Users/mbp/Documents/lib' is added to the PYTHONPATH. You can also add module search paths by creating a path configuration file (.pth) in the site-packages directory.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ get-location-of-python-site-packages-directory
Get Location of Python site-packages Directory - GeeksforGeeks
January 9, 2023 - Finding the site-packages directory containing all the packages installed in the Python distribution. Finding the package directory of a specific package/library. The Global site-packages directory (or dist-packages) could be located by running the following command in the command interpreter (cmd.exe or terminal) of your Operating System: ... This gives a list of all the packages installed on the user and base sites, including the directories listed in the sys.path file.