Different python versions confusion under Windows Vista x64

Discussion in 'Python' started by Edward Diener, Jul 19, 2010.

  1. In Windows Vista x64 I have installed python 2.6 64-bit version and
    python 3.1 64-bit version to separate folders. Within the command
    interpreter I add python 2.6 to the PATH.

    In the command interpreter, When I type python somescript.py with an

    import sys
    print (sys.version)

    in the script, it shows:

    3.1.2 (r312:79149, Mar 20 2010, 22:55:39) [MSC v.1500 64 bit (AMD64)]

    In the command interpreter if I type 'python' I see:

    Python 2.6.5 (r265:79096, Mar 19 2010, 18:02:59) [MSC v.1500 64 bit
    (AMD64)] on win32

    Does anybody have any ideas why this is happening ?
     
    Edward Diener, Jul 19, 2010
    #1
    1. Advertising

  2. * Edward Diener, on 19.07.2010 14:53:
    > In Windows Vista x64 I have installed python 2.6 64-bit version and
    > python 3.1 64-bit version to separate folders. Within the command
    > interpreter I add python 2.6 to the PATH.
    >
    > In the command interpreter, When I type python somescript.py with an
    >
    > import sys
    > print (sys.version)
    >
    > in the script, it shows:
    >
    > 3.1.2 (r312:79149, Mar 20 2010, 22:55:39) [MSC v.1500 64 bit (AMD64)]
    >
    > In the command interpreter if I type 'python' I see:
    >
    > Python 2.6.5 (r265:79096, Mar 19 2010, 18:02:59) [MSC v.1500 64 bit
    > (AMD64)] on win32
    >
    > Does anybody have any ideas why this is happening ?


    At a guess your description of what's happening is not entirely accurate.

    Although it could be, since Windows moves in mysterious ways.

    Please try the following commands in sequence, with no other commands:

    python -V
    echo %path%
    ftype python.file
    python somescript.py

    Then right-click the command interpreter's title bar to get edit menu. /Mark/
    the text of your commands and results. Then /copy/ it to the clipboard (note:
    you can't use [Ctrl C] here, use the edit menu or just press Enter). Then post
    the commands and results here, /paste/ them into your message (e.g. [Ctrl V]).

    And then, if you haven't already figured it out, somebody probably will. :)


    Cheers & hth.,

    - Alf

    --
    blog at <url: http://alfps.wordpress.com>
     
    Alf P. Steinbach /Usenet, Jul 19, 2010
    #2
    1. Advertising

  3. On 7/19/2010 9:15 AM, Alf P. Steinbach /Usenet wrote:
    > * Edward Diener, on 19.07.2010 14:53:
    >> In Windows Vista x64 I have installed python 2.6 64-bit version and
    >> python 3.1 64-bit version to separate folders. Within the command
    >> interpreter I add python 2.6 to the PATH.
    >>
    >> In the command interpreter, When I type python somescript.py with an
    >>
    >> import sys
    >> print (sys.version)
    >>
    >> in the script, it shows:
    >>
    >> 3.1.2 (r312:79149, Mar 20 2010, 22:55:39) [MSC v.1500 64 bit (AMD64)]
    >>
    >> In the command interpreter if I type 'python' I see:
    >>
    >> Python 2.6.5 (r265:79096, Mar 19 2010, 18:02:59) [MSC v.1500 64 bit
    >> (AMD64)] on win32
    >>
    >> Does anybody have any ideas why this is happening ?

    >
    > At a guess your description of what's happening is not entirely accurate.
    >
    > Although it could be, since Windows moves in mysterious ways.
    >
    > Please try the following commands in sequence, with no other commands:
    >
    > python -V
    > echo %path%
    > ftype python.file
    > python somescript.py
    >
    > Then right-click the command interpreter's title bar to get edit menu.
    > /Mark/ the text of your commands and results. Then /copy/ it to the
    > clipboard (note: you can't use [Ctrl C] here, use the edit menu or just
    > press Enter). Then post the commands and results here, /paste/ them into
    > your message (e.g. [Ctrl V]).
    >
    > And then, if you haven't already figured it out, somebody probably will.
    > :)


    I figured out the cause. One of the Python scripts started with:

    #!Path/to/Python31Executable

    which evidently caused python 3.1 to be called to run that script. I am
    not sure that script was run via an 'import' statement, as opposed to a
    'python someScript.py' within another script, but I suspect the latter.
     
    Edward Diener, Jul 19, 2010
    #3
  4. On 7/19/2010 5:45 PM, Edward Diener wrote:
    > On 7/19/2010 9:15 AM, Alf P. Steinbach /Usenet wrote:
    >> * Edward Diener, on 19.07.2010 14:53:
    >>> In Windows Vista x64 I have installed python 2.6 64-bit version and
    >>> python 3.1 64-bit version to separate folders. Within the command
    >>> interpreter I add python 2.6 to the PATH.
    >>>
    >>> In the command interpreter, When I type python somescript.py with an
    >>>
    >>> import sys
    >>> print (sys.version)
    >>>
    >>> in the script, it shows:
    >>>
    >>> 3.1.2 (r312:79149, Mar 20 2010, 22:55:39) [MSC v.1500 64 bit (AMD64)]
    >>>
    >>> In the command interpreter if I type 'python' I see:
    >>>
    >>> Python 2.6.5 (r265:79096, Mar 19 2010, 18:02:59) [MSC v.1500 64 bit
    >>> (AMD64)] on win32
    >>>
    >>> Does anybody have any ideas why this is happening ?

    >>
    >> At a guess your description of what's happening is not entirely accurate.
    >>
    >> Although it could be, since Windows moves in mysterious ways.
    >>
    >> Please try the following commands in sequence, with no other commands:
    >>
    >> python -V
    >> echo %path%
    >> ftype python.file
    >> python somescript.py
    >>
    >> Then right-click the command interpreter's title bar to get edit menu.
    >> /Mark/ the text of your commands and results. Then /copy/ it to the
    >> clipboard (note: you can't use [Ctrl C] here, use the edit menu or just
    >> press Enter). Then post the commands and results here, /paste/ them into
    >> your message (e.g. [Ctrl V]).
    >>
    >> And then, if you haven't already figured it out, somebody probably will.
    >> :)

    >
    > I figured out the cause. One of the Python scripts started with:
    >
    > #!Path/to/Python31Executable
    >
    > which evidently caused python 3.1 to be called to run that script. I am
    > not sure that script was run via an 'import' statement, as opposed to a
    > 'python someScript.py' within another script, but I suspect the latter.


    No, this is incorrect. The cause had nothing to do with the above. It
    was because .py files were associated with the 3.1 version of Python, no
    Python folder was in the PATH, and a Pyhton script invoked python
    passing it a .py file. So even though the initial command specified the
    2.6 version of Python on a script, subsequent scripts were run using
    Python 3.1.

    I since changed the association of .py files to the 2.6 version of
    Python and everything works correctly.
     
    Edward Diener, Jul 20, 2010
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    8
    Views:
    666
    =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=
    Apr 11, 2007
  2. Replies:
    5
    Views:
    1,579
    =?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=
    Sep 24, 2007
  3. SiWi
    Replies:
    2
    Views:
    1,159
  4. HolgerEb1

    CreateDC on Windows 2008 X64 under IIS

    HolgerEb1, Jan 20, 2009, in forum: ASP General
    Replies:
    1
    Views:
    425
    Bob Barrows
    Jan 20, 2009
  5. mysiar

    Vista x64 + DBD::Pg driver

    mysiar, Jan 26, 2009, in forum: Perl Misc
    Replies:
    7
    Views:
    112
    mysiar
    Jan 30, 2009
Loading...

Share This Page