I have several python executables available from within a default powershell prompt as shown by where.exe python
:
C:\Program Files\Inkscape\bin\python.exe
C:\Users\921479\AppData\Local\Programs\Python\Python310\python.exe
C:\Users\921479\AppData\Local\Microsoft\WindowsApps\python.exe
When I launch a python interpreter from this powershell prompt, it uses the first executable:
>>>python
Python 3.9.7 (default, Sep 22 2021, 08:12:47) [GCC 10.3.0 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', 'C:\\Program Files\\Inkscape\\lib\\python39.zip', 'C:\\Program Files\\Inkscape\\lib\\python3.9', 'C:\\Program Files\\Inkscape\\lib\\python3.9\\lib-dynload', 'C:\\Users\\921479', 'C:\\Program Files\\Inkscape\\lib\\python3.9\\site-packages']
I don't want to remove C:\Program Files\Inkscape\bin
from my windows path environment variable, since I use the inkscape
command line tool for other purposes. However, I would prefer that powershell use the local installation of python 3.10 as my "default" python interpreter.
When I check the $env:path
variable, it looks like the Inkscape folder is defined after the python 3.10 folder. So it looks like something else is used to resolve the python executable:
>>>$env:path
C:\Python310\Scripts\;C:\Python310\;C:\Python39\Scripts\;C:\Python39\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\ProgramData\chocolatey\bin;C:\Users\921479\AppData\Local\SumatraPDF;C:\Program Files\Git\cmd;C:\texlive\2021\bin\win32;C:\Program Files (x86)\PDFtk Server\bin\;C:\Program Files (x86)\Lua\5.1;C:\Program Files (x86)\Lua\5.1\clibs;C:\Program Files\Inkscape\bin;C:\Program Files\dotnet\;C:\Users\921479\AppData\Local\Programs\Python\Python310\Scripts\;C:\Users\921479\AppData\Local\Programs\Python\Python310\;C:\Users\921479\AppData\Local\Microsoft\WindowsApps;C:\Users\921479\.dotnet\tools
How does powershell/windows decide which python
executable to use? How can I modify this?