简体   繁体   English

Python 3.2不适用于python 2.7

[英]Python 3.2 doesn't work with python 2.7

I already have python 2.7 (installed using activepython). 我已经有python 2.7(使用activepython安装)。 I'm trying to use python 3.2 just to learn more about it so i downloaded it from python.org 我正在尝试使用python 3.2只是为了更多地了解它,所以我从python.org下载了它

python 2.7 still works perfectly, but python 3.2 gives me this error when i try to open the ide. python 2.7仍然可以正常工作,但是当我尝试打开ide时,python 3.2给了我这个错误。

在此输入图像描述

and then I see the send error window, if i install python 3.2 using activepython i see the same error. 然后我看到发送错误窗口,如果我使用activepython安装python 3.2我看到相同的错误。

I'm using windows xp pro sp3 32 bit and i had the same error on sp2... How do I fix it? 我正在使用windows xp pro sp3 32位,我在sp2上遇到了同样的错误...我该如何解决?

EDIT @Zuljin 编辑@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... 我已经有了这些文件......

Python 2.x and 3.x can cohabitate perfectly in win xp and win 7, either 32 or 64 bits. Python 2.x和3.x可以在win xp和win 7中完美地共存,32位或64位。 If you first installed the ActiveState Python distribution, be careful when installing python-3.2.2.msi. 如果您第一次安装ActiveState Python发行版,请在安装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). 当你到达自定义python 3.2.2屏幕时,(un)检查'注册扩展'以使功能不可用(即:不注册扩展)。

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) 只有python 2.7应该在路径中(如果你在两个发行版之前安装,你可以在路径中都有它们。删除python 3.2路径)

Edit: From Ankit post I realized that in fact you were trying to open IDLE, maybe. 编辑:从Ankit帖子我意识到事实上你正试图打开IDLE,也许吧。 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. 如果你从py3.2 idlelib文件夹中调用idle.bat时遵循我的安装说明,你实际上会为python 2.7闲置,因为这是调用在windows路径中找到的内容。 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: 为了能够在python 2.7作为注册的python存在的情况下为py3.2打开空闲,我使用从分发中修改的.bat文件:

idle_stay.bat 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 ). 名称idle_stay.bat是因为我将此文件放在官方idle.bat所在的文件夹中( 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 这样,每次我unisntall并重新安装新版本的python 3时,它都不会被覆盖

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

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. 在我看来,您已将* .py或* .pyw文件扩展名类型与某些版本的python.exe和/或pythonw.exe相关联,您不清楚。 This is often, but not exclusively done from within Microsoft's "explore.exe" File Manager (I believe in Options). 这通常是微软的“explore.exe”文件管理器(我相信选项),但不是唯一的。

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. 因为此方法将运行分配给“pyw”扩展的任何程序。 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. 或者根据操作系统或错误的PATH环境变量设置,您的文件扩展名关联可能发生的任何事情。 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. 您明确告诉操作系统从特定路径运行python可执行文件并在文件/文件夹层次结构中选择特定的python脚本。

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: 您可以做的另一件事:打开DOS命令提示符并键入:

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. 一旦调试你的PATH。 You can use this Python script to gather intel. 您可以使用此Python脚本来收集英特尔。

If you turned off your WinXP findfile stuff (like I have) you can use this script: 如果你关闭了你的WinXP findfile东西(比如我有),你可以使用这个脚本:

inpath.py can help shed some light. inpath.py可以帮助解决一些问题。 Run this python script like this: 像这样运行这个python脚本:

  1. Drop to a DOS prompt 下拉到DOS提示符
  2. cd to your folder with a working python.exe version. 使用工作的python.exe版本cd到您的文件夹。
  3. and type python.exe inpath.py python* where inpath is in that same folder for this test/debug. 并键入python.exe inpath.py python *其中inpath位于此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. inpath.py将在您的路径中搜索与您的操作系统中“可运行”相关联的所有文件,并使用python *。*模式在“PATH”中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM