Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Different python versions confusion under Windows Vista x64

Reply
Thread Tools

Different python versions confusion under Windows Vista x64

 
 
Edward Diener
Guest
Posts: n/a
 
      07-19-2010
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 ?

 
Reply With Quote
 
 
 
 
Alf P. Steinbach /Usenet
Guest
Posts: n/a
 
      07-19-2010
* 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>
 
Reply With Quote
 
 
 
 
Edward Diener
Guest
Posts: n/a
 
      07-19-2010
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.
 
Reply With Quote
 
Edward Diener
Guest
Posts: n/a
 
      07-20-2010
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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
A router running under WinXP runs under Windows Vista too? Peter Wagner Wireless Networking 12 02-04-2008 11:02 PM
Installing x64 Vista on Vistual PC 2007 with host Vista x64 =?Utf-8?B?cnBnX2NvZGVfbWFzdGVy?= Windows 64bit 6 06-16-2007 04:56 PM
Windows Desktop Search 3.0 Beta 2 for Windows x64 versions Dominic Payer Windows 64bit 2 08-23-2006 01:15 AM
x64-to-Vista: Will clean-install Vista "upgrade" invalidate x64 license? DP Windows 64bit 11 07-22-2006 11:00 PM
Windows installer, different versions of Python on Windows Max M Python 1 10-10-2005 01:26 PM



Advertisments