Try using py -3.9 instead of python. Is D:\python\python36 in your path ?
Try using py -3.9 instead of python. Is D:\python\python36 in your path ?
Set the PYTHONNOUSERSITE variable in Windows environment variables settings. It can be located in either "User variables for ่ฒ" or "System variables". Its value can be 1 or 2, as shown in the question attached image.
In the question case, setting PYTHONNOUSERSITE=1 or PYTHONNOUSERSITE=2, it will disable the "c:\Users\่ฒ\AppData\Local\Packages\..." path, and use the "D:\python\python36\Lib\site-packages" as python's site-packages.
You can use the Site-specific configuration hook.
"A path configuration file is a file whose name has the form
name.pthand exists in one of the four directories mentioned above; its contents are additional items (one per line) to be added tosys.path."
In your case, you should be able to achieve what you want by simply dropping in a .pth file containing the path of the directory to include:
[root@home]$ echo "/usr/local/lib/python2.7/site-packages/" > /opt/python2.7.2/lib/python2.7/site-packages/usrlocal.pth
You could replace the python executable with a wrapper script which appends your added installpath to PYTHONPATH. But this is a kludge.
But I'd try to fix the installation of the add-on so that it properly goes into the site-packages dir.
There are two types of site-packages directories, global and per user.
Global site-packages ("dist-packages") directories are listed in
sys.pathwhen you run:python -m siteFor a more concise list run
getsitepackagesfrom 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.pathfrom 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"])'The per user site-packages directory (PEP 370) is where Python installs your local packages:
python -m site --user-siteIf this points to a non-existing directory check the exit status of Python and see
python -m site --helpfor explanations.Hint: Running
pip list --userorpip freeze --usergives 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.pyRun
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
>>> 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])
site-packages is the target directory of manually built Python packages. When you build and install Python packages from source (using distutils, probably by executing python setup.py install), you will find the installed modules in site-packages by default.
There are standard locations:
- Unix (pure)1:
prefix/lib/pythonX.Y/site-packages - Unix (non-pure):
exec-prefix/lib/pythonX.Y/site-packages - Windows:
prefix\Lib\site-packages
1 Pure means that the module uses only Python code. Non-pure can contain C/C++ code as well.
site-packages is by default part of the Python search path, so modules installed there can be imported easily afterwards.
Useful reading
- Installing Python Modules (for Python 2)
- Installing Python Modules (for Python 3)
When you use --user option with pip, the package gets installed in user's folder instead of global folder and you won't need to run pip command with admin privileges.
The location of user's packages folder can be found using:
python -m site --user-site
This will print something like:
C:\Users\%USERNAME%\AppData\Roaming\Python\Python35\site-packages
When you don't use --user option with pip, the package gets installed in global folder given by:
python -c "import site; print(site.getsitepackages())"
This will print something like:
['C:\\Program Files\\Anaconda3', 'C:\\Program Files\\Anaconda3\\lib\\site-packages'
Note: Above printed values are for On Windows 10 with Anaconda 4.x installed with defaults.