(Nov-28-2022, 10:09 AM)jerryf Wrote: Thanks again snippsat. So to confirm my understanding-when using cmd mode python does not appear to make any reference or use of Path and PYTHONPATH environment variables in searching for the script file, and so a full pathname must always be given unless starting from the directory containing the script file. Is that correct?Yes.
Never do this.
1 |
C:\Users\jerry>hello_world.py |
file associations
is correct and this can suddently change.Use
python
,the you know that it will use Python 3.11.1 |
C:\Users\jerry>python hello_world.py |
python.exe
and what file associations is set to dosn't matter.1 2 3 |
# A test to make sure with full path to python.exe C:\Users>python - c "import sys; print(sys.executable)" C:\python310\python.exe |
py
,can by used to run any python version.See that i have python 3.11,but still have python in OS Path that point to 3.10
1 2 3 4 5 6 7 8 |
# <py> will find newest one and don't care about what is OS path G:\div_code λ py - V Python 3.11 . 0 G:\div_code λ python - V Python 3.10 . 5 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
G:\div_code λ py - - list - V: 3.11 * Python 3.11 ( 64 - bit) - V: 3.10 Python 3.10 ( 64 - bit) - V: 3.9 Python 3.9 ( 64 - bit) - V: 3.8 Python 3.8 ( 64 - bit) - V: 3.7 - 32 Python 3.7 ( 32 - bit) - V: 3.6 - 32 Python 3.6 ( 32 - bit) - V: 3.5 - 32 - V: 3.4 - V: 2.7 - V: 2.1 - V:ContinuumAnalytics / Anaconda39 - 64 Anaconda py39_4. 9.2 - V:ContinuumAnalytics / Anaconda37 - 64 Anaconda 4.7 . 12 - V:ContinuumAnalytics / Anaconda36 - 32 Anaconda 4.3 . 14 |