Installing Python 3 on Windows

Uri Even-Chen uri at speedy.net
Tue Aug 2 10:12:33 EDT 2016


Thank you, repair worked! I already have py.ini and don't want to add
shebangs, I have at least 50 Python files and I don't want to edit all of
them.


*Uri Even-Chen*
[image: photo] Phone: +972-54-3995700
Email: uri at speedy.net
Website: http://www.speedysoftware.com/uri/en/
<http://www.facebook.com/urievenchen>  <http://plus.google.com/+urievenchen>
  <http://www.linkedin.com/in/urievenchen>  <http://twitter.com/urievenchen>

On Tue, Aug 2, 2016 at 4:50 PM, eryk sun <eryksun at gmail.com> wrote:

> On Tue, Aug 2, 2016 at 12:11 PM, Uri Even-Chen <uri at speedy.net> wrote:
> >
> > I want to install Python 3 on Windows, but I also need Python 2 for
> Google
> > App Engine SDK. When I type a name of a Python file in command line, I
> want
> > it to run with Python 3. However, I checked with "print 3/5" and it
> printed
> > 0 - Python 2. I have the latest versions of Python installed
> > - python-2.7.12.msi and python-3.5.2.exe
> >
> >>python --version
> > Python 2.7.12
> >
> >>assoc .py
> > .py=Python.File
> >
> >>ftype Python.File
> > Python.File="C:\Python27\python.exe" "%1" %*
>
> Open the control panel's "Programs and Features". Look for the most
> recently installed "Python Launcher"; right-click it and select
> "Repair". That should fix the Python.File and Python.NoConFile
> commands. If these commands aren't your current choice in Explorer,
> open Default Programs->Set Associations. Change the association for
> .py and .pyw to "Python". If there are multiple "Python" entries in
> the list, the icon of the correct one should have a rocket (a
> launcher) in the upper left-hand corner.
>
> The launcher handles shebangs and even accepts common Unix paths such
> as /usr/bin, e.g.:
>
> Latest 2.x:  #! /usr/bin/python
> Latest 3.x:  #! /usr/bin/python3
>
> Without a shebang the launcher currently defaults to Python 2 if it's
> installed. To always use Python 3 as the default, set the environment
> variable `PY_PYTHON=3`.
>
> > By the way, i[s] there a way to print the Python version from Python?
>
> sys.version is the version string. sys.version_info is a named
> sequence of version information:
>
>     >>> sys.version_info
>     sys.version_info(major=2, minor=7, micro=12, releaselevel='final',
> serial=0)
>     >>> sys.version_info[:]
>     (2, 7, 12, 'final', 0)
>
>     >>> sys.version_info
>     sys.version_info(major=3, minor=5, micro=2, releaselevel='final',
> serial=0)
>     >>> sys.version_info[:]
>     (3, 5, 2, 'final', 0)
>



More information about the Python-list mailing list