(Jul-07-2017, 06:27 AM)pstein Wrote: I am thinking about a command parameter like (python.exe is v3.*):
python.exe -execute_as_v2 myscript.py
Have one version that you use most set in Path.
Look at my tutorial
here.
So main version is 3.6 here.
C:\1
λ python -V
Python 3.6.1
C:\1
λ pip -V
pip 9.0.1 from c:\python36\lib\site-packages (python 3.6)
C:\1
λ python version.py
Hello from 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 17:54:52) [MSC v.1900 32 bit (Intel)]
# version.py
import sys
print('Hello from {}'.format(sys.version))
I have had om some computer with many version maybe 7-8 installed on Windows.
Running other version and install with pip.
C:\1
λ py -2.7 version.py
Hello from 2.7.9 (default, Dec 10 2014, 12:24:55) [MSC v.1500 32 bit (Intel)]
C:\1
λ py -2.7 -m pip install requests
Requirement already satisfied: requests in c:\python27\lib\site-packages
So here running Python 2.7 and can install with
pip
using
-m
command.
This work for all version installed.
C:\1
λ py -3.4 version.py
Hello from 3.4.2 (v3.4.2:ab2c023a9432, Oct 6 2014, 22:15:05) [MSC v.1600 32 bit (Intel)]
C:\1
λ py -3.4 -m pip install requests
Collecting requests
Downloading requests-2.18.1-py2.py3-none-any.whl (88kB)
100% |################################| 92kB 385kB/s
Successfully installed certifi-2017.4.17 chardet-3.0.4 idna-2.5 requests-2.18.1 urllib3-1.21.1
C:\1
λ py -3.5 version.py
Hello from 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:18) [MSC v.1900 32 bit (Intel)]
C:\1
λ py -3.5 -m pip install requests
Requirement already satisfied: requests in c:\python35\lib\site-packages