verwendet.
Wie kann ich den Benutzerinstallationsort für auf diese Weise installierte Skripte programmgesteuert ermitteln? Ich spreche von dem Verzeichnis, das zum PATH hinzugefügt werden sollte, damit installierte Pakete über die Befehlszeile aufgerufen werden können.
Zum Beispiel erhalte ich unter Windows bei der Installation von pip install -U pylint --user die folgende Warnung, weil ich sie nicht habe 'C:\Users\myusername\AppData\Roaming\Python\Python37\Scripts' in meinem PATH:
Code: Select all
...
Installing collected packages: wrapt, six, typed-ast, lazy-object-proxy, astroid, mccabe, isort, colorama, toml, pylint
Running setup.py install for wrapt ... done
WARNING: The script isort.exe is installed in 'C:\Users\myusername\AppData\Roaming\Python\Python37\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
WARNING: The scripts epylint.exe, pylint.exe, pyreverse.exe and symilar.exe are installed in 'C:\Users\myusername\AppData\Roaming\Python\Python37\Scripts' which is not on PATH.
Code: Select all
def get_user_install_scripts_dir():
...
# would return 'C:\Users\myusername\AppData\Roaming\Python\Python37\Scripts'
# on Windows with Python 3.7.x, '/home/myusername/.local/bin' in Linux, etc
return platform_scripts_dir
Code: Select all
PS C:\Users\myusername\> python -m site --user-base
C:\Users\myusername\AppData\Roaming\Python
$ python -m site --user-base
/home/myusername/.local
Mobile version