Python 3.2 doesn't work with python 2.7

一世执手 提交于 2019-12-13 03:42:55

问题


I already have python 2.7 (installed using activepython). I'm trying to use python 3.2 just to learn more about it so i downloaded it from python.org

python 2.7 still works perfectly, but python 3.2 gives me this error when i try to open the ide.

and then I see the send error window, if i install python 3.2 using activepython i see the same error.

I'm using windows xp pro sp3 32 bit and i had the same error on sp2... How do I fix it?

EDIT @Zuljin

This is the first time that i use dependancy walker so could you give me a hand please

this is what i see

what does that mean? I already have these files...


回答1:


I saw a lot of answers here. But, I think the file that you are trying to run is not correct

C:\Python32\Pythonw.exe

is not the one you use to open idle.

Open

C:\Python32\Lib\idlelib\idle.pyw



回答2:


Python 2.x and 3.x can cohabitate perfectly in win xp and win 7, either 32 or 64 bits. If you first installed the ActiveState Python distribution, be careful when installing python-3.2.2.msi. When you arrive to the customize python 3.2.2 screen, (un)check 'register extensions' to make the feature unavailable (that is: do not register extensions).

I have installed this way both distributions in different computers without any problem so far.

Note: Check your environment variables. Only python 2.7 should be in the path (if you installed before the two distros you could have them both in the path. Remove python 3.2 path)

Edit: From Ankit post I realized that in fact you were trying to open IDLE, maybe. If you follow my installation instructions when you call idle.bat from the py3.2 idlelib folder you actually get idle for python 2.7 as this is what the call find in the windows path. To be able to open idle for py3.2 in the presence of python 2.7 as the registered python, I use a .bat file modified from that in the distribution:

idle_stay.bat

@echo off
rem Working IDLE bat for Windows - Custom bat for py3k as secundary python
C:\Python32\pythonw C:\Python32\Lib\idlelib\idle.pyw %1 %2 %3 %4 %5 %6 %7 %8 %9

The name idle_stay.bat is because I put this file in the folder where the official idle.bat is (C:\Python32\Lib\idlelib\idle_stay.bat). In this way it does not get overwritten each time I unisntall and reinstall a new version of python 3




回答3:


It seems to me you have associated a *.py or *.pyw file extension type to some version of python.exe and/or pythonw.exe you aren't clear about. This is often, but not exclusively done from within Microsoft's "explore.exe" File Manager (I believe in Options).

I disagree that this is a reliable method:

C:\Python32\Lib\idlelib\idle.pyw 

as this method will run whichever program is assigned to the "pyw" extension. That could be:

C:\Python32\pythonw.exe 

or

C:\Python26\python.exe

or whatever might have happened to your file extension association as per OS or bad PATH environment variable setting. It is better to do something like this:

C:\Python32\pythonw.exe C:\Python32\Lib\idlelib\idle.pyw

where you are explicidly telling the OS to run the python executable from a specific path and selecting a specific python script in the file/folder hiearchy.

Another thing you can try to gather info is just:

python.exe -V

which will tell you the version number.

Another thing you can do: Open a DOS command prompt and type:

set PATH=C:\Windows;C:\Windows\system32;C:\Python32
python.exe      and note the version and whether is runs.
exit()
exit

Once working debug your PATH. You can use this Python script to gather intel.

If you turned off your WinXP findfile stuff (like I have) you can use this script:

inpath.py can help shed some light. Run this python script like this:

  1. Drop to a DOS prompt
  2. cd to your folder with a working python.exe version.
  3. and type python.exe inpath.py python* where inpath is in that same folder for this test/debug.

inpath.py will search your path for all files associated as "runable" in your OS and that is in your "PATH" with the python*.* pattern.



来源:https://stackoverflow.com/questions/8392689/python-3-2-doesnt-work-with-python-2-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!