Python Forum

Full Version: Python App On Different Versions
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
How To know if my python app can run on different versions of python 3.x And 2.7 also!
(Aug-25-2020, 01:46 PM)Harshil Wrote: [ -> ]How To know if my python app can run on different versions of python 3.x And 2.7 also!
well, you should know how you have written it (what minimum target version you had in mind). of course you should know also the differences in different python versions. At the moment it no longer makes sense to target python2 at all
In addition to buran's recommendation,

if you install pyenv (see: https://python-forum.io/Thread-pyenv-Sim...ight=pyenv )
you can easily switch python versions and then try running under each

and again, stay away from python 2.7 it's extinct
If on Windows look here.
There is part about py there,which is used to run other versions.
C:\1
λ python -V
Python 3.8.3

C:\1
λ python hello.py
Hello from 3.8.3

# Run 2.7
C:\1
λ py -2.7 hello.py
Hello from 2.7.9

# Install to 2.7
λ py -2.7 -m pip install logzero
Requirement already satisfied: colorama; sys_platform == "win32" in c:\python27\lib\site-packages (from logzero) (0.3.2)
So python and pip always point to then main version eg 3.8,and py can access all other version from python.org.