无法打开 Python。错误 0xc000007b
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20650596/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Cannot Open Python. Error 0xc000007b
提问by user3113898
I have recently been learning Python 3. I have had no problems on my netbook (32bit Windows 7) I with creating small simple programs. When I installed it on my netbook I had no problems, but now that I've been getting into it I want to install it on my desktop and I have one. My desktop is a 64 bit OS running Windows 7. Like I did with my netbook, I went to download Python and install the 64 bit edition.
我最近一直在学习 Python 3。我在上网本(32 位 Windows 7)上创建小型简单程序时没有遇到任何问题。当我将它安装到我的上网本上时,我没有遇到任何问题,但是现在我已经开始使用它了,我想将它安装在我的桌面上并且我有一个。我的桌面是运行 Windows 7 的 64 位操作系统。就像我使用上网本一样,我去下载 Python 并安装 64 位版本。
After installing it, I went to open up Python CLI and GUI and no luck. It gave me this error.
安装后,我去打开 Python CLI 和 GUI,但没有运气。它给了我这个错误。
"The application was unable to start correctly (0xc000007b). Click OK to close the application"
I also tried reinstalling, but not luck.
我也尝试重新安装,但不是运气。
I suspect a missing .dll but I am not completely sure. Does anyone know what is keeping me from opening Python and how do I fix it?. I want to resume my work as soon as possible.
我怀疑缺少 .dll,但我不完全确定。有谁知道是什么让我无法打开 Python 以及如何修复它?我想尽快恢复我的工作。
回答by m01
Apparently the error code stands for STATUS_INVALID_IMAGE_FORMAT(source), and it looks like it's not specific to Python. You can try reinstalling the program, rebooting, running CHKDSK /r(source). It might also have something to do with the Microsoft Visual C++ redistributable package, as Janne Karila and this threadsuggest.
显然,错误代码代表STATUS_INVALID_IMAGE_FORMAT( source),看起来它不是 Python 特有的。您可以尝试重新安装程序、重新启动、运行CHKDSK /r(source)。正如 Janne Karila 和该线程所建议的那样,它也可能与 Microsoft Visual C++ 可再发行组件包有关。
This stackoverflow questionalso looks like it has some useful information.
这个stackoverflow 问题看起来也有一些有用的信息。
回答by David Heffernan
That is the NTSTATUSerror code for STATUS_INVALID_IMAGE_FORMAT. Almost invariably that means that the loaded is attempting to link a 32 bit DLL into a 64 bit process, or vice versa.
那是 的NTSTATUS错误代码STATUS_INVALID_IMAGE_FORMAT。这几乎总是意味着加载程序试图将 32 位 DLL 链接到 64 位进程,反之亦然。
If you want to attempt to debug this then the tool of choice is Dependency Walker. You open the python.exe executable file in Dependency Walker and use the profile menu to start it up with logging of the load events. Somewhere along the way there will be a failure and you'll be able to see which module is causing that failure. That will hopefully point the way towards a resolution.
如果您想尝试调试它,那么选择的工具是 Dependency Walker。您在 Dependency Walker 中打开 python.exe 可执行文件,并使用配置文件菜单启动它并记录加载事件。在此过程中的某个地方会出现故障,您将能够看到哪个模块导致了该故障。这有望为解决问题指明道路。
However, attempting to debug this may be a waste of time. It will probably better to uninstall the existing installation, and try to re-install. Perhaps picking a different Python distribution.
但是,尝试调试这可能是浪费时间。卸载现有安装并尝试重新安装可能会更好。也许选择不同的 Python 发行版。
I note that you have selected a 64 bit version. Now, support for 64 bit extension modules is not as strong on 64 bit Python as on 32 bit Python. It does exist, but they modules can be harder to come by and install. You might consider installing a 32 bit Python next time round.
我注意到您选择了 64 位版本。现在,对 64 位扩展模块的支持在 64 位 Python 上不如在 32 位 Python 上那么强。它确实存在,但它们的模块可能更难获得和安装。下次您可能会考虑安装 32 位 Python。
回答by Kuddusi ?ift?iba??
Please make sure that Python3.dll is the same version and the same architecture (32/64) with python.exe. I fixed this error via replacing it with 32bit version.
请确保Python3.dll与python.exe版本相同,架构相同(32/64)。我通过用 32 位版本替换它来修复这个错误。
回答by Efren
As janne-karilamentioned, and for Python 3.5, Microsoft Visual Studio 2015 redistributable(in this case the 64 bit version)
正如janne-karila 所提到的,对于Python 3.5,Microsoft Visual Studio 2015 可再发行版(在本例中为 64 位版本)
回答by MarcelineH
This probably won't answer your question, but my answer is for a very specific case when you "Refresh Windows without affecting Files" to fix your Windows 8.1 PC.
这可能无法回答您的问题,但我的回答是针对您“刷新 Windows 而不影响文件”以修复 Windows 8.1 PC 时的一个非常具体的情况。
If you do that, You'd get this error when you try to run Python after the windows refresh.
如果你这样做,当你在 Windows 刷新后尝试运行 Python 时你会得到这个错误。
To fix this error, simply re-install PY at the same folder where your python was install before you refreshed windows. If you try to install it any other folder like username/appdata/... folder the PY installer would be stuck in initialization.
要修复此错误,只需在刷新 Windows 之前在安装 python 的同一文件夹中重新安装 PY。如果您尝试将其安装到任何其他文件夹(如 username/appdata/... 文件夹),PY 安装程序将卡在初始化中。
You may also get another error saying "api-ms-win-crt-runtime-l1-1-0.dll is missing". To fix, go to the windows.old folder and get the dll file ith the above name and paste it in the PY folder. Also like others have suggested, make sure Microsoft Visual Studio 2015 redistributable is installed.
您可能还会收到另一个错误消息,提示“缺少 api-ms-win-crt-runtime-l1-1-0.dll”。要修复,请转到 windows.old 文件夹并获取具有上述名称的 dll 文件并将其粘贴到 PY 文件夹中。也像其他人建议的那样,确保安装了 Microsoft Visual Studio 2015 可再发行组件。
Encountering this error after a windows refresh is so rare, that no one else seemed to have experienced according to google searches, so I though I share it here for that rare unlucky person.
在 Windows 刷新后遇到此错误非常罕见,根据谷歌搜索似乎没有其他人遇到过,所以我虽然我在这里为那个罕见的不幸的人分享了它。
回答by Ram Vallabh Singh
I too faced this problem. So I uninstalled python3 64-bit version and installed 32-bit version, after that i am able to launch python3 in windows 8 successfully. (i have a 64-bit laptop).
我也遇到了这个问题。所以我卸载了python3 64位版本并安装了32位版本,之后我就可以在windows 8中成功启动python3了。(我有一台 64 位笔记本电脑)。
回答by Ghanem
Simply, download the last version of Microsoft Visual C++ redistributable package ..
只需下载最新版本的 Microsoft Visual C++ 可再发行组件包..
I had the same problem ..
我有同样的问题 ..
回答by Himanshu_Singh_PM
I have the same error found. Using dependency walker, I found tons of DLLs missing. Rather going for copying all the DLLs I went with virtual environment. It will create another environment for Python.
我发现了同样的错误。使用依赖遍历器,我发现大量的 DLL 丢失了。而是复制我在虚拟环境中使用的所有 DLL。它将为 Python 创建另一个环境。
First, install python normally. Copy, the Python.exe path. In my case, it is
首先,正常安装python。复制 Python.exe 路径。就我而言,它是
C:\Python\python
It will be used to install Python libraries. Then, using command prompt, I used pip to download and install virtualenv (Virtual environment). To do that, change the directory to where pip.exe is, which is in Scripts folder. Now, run the following to install virtualenv:
它将用于安装 Python 库。然后,使用命令提示符,我使用 pip 下载并安装 virtualenv(虚拟环境)。为此,请将目录更改为 pip.exe 所在的位置,该目录位于 Scripts 文件夹中。现在,运行以下命令来安装 virtualenv:
C:\Python\python pip install virtualenv
It will install Virtual environment.
它将安装虚拟环境。
Now, create a folder to hold virtual environment and change directory to that folder and run to create the following to create an environment:
现在,创建一个文件夹来保存虚拟环境并将目录更改为该文件夹并运行以创建以下内容以创建环境:
virtualenv --no-site-packages [environment name]
It will create the Environment.
它将创建环境。
Now, change subdirectory to Scripts in the [environment name] folder. There is a activate file run it, in my case it is like:
现在,将子目录更改为 [environment name] 文件夹中的 Scripts。有一个激活文件运行它,在我的情况下它是这样的:
C:\Python\virtualenv\env\Scripts activate
env is the [environment name] here.
env 是这里的 [环境名称]。
If you activate it, every command will look like:
如果您激活它,每个命令将如下所示:
(env) C:\Python\python
This ends here. Now, you can install any python library using this. Do whatever, you want using Python.
到此结束。现在,您可以使用它安装任何 python 库。做任何事情,你想使用 Python。
Also, to deactivate the environment same deactivate.bat is in the scripts folder.
此外,要停用环境,同样的deactivate.bat 位于脚本文件夹中。
回答by Mohammad Amin Eskandari
you should delete the old path of python in "Environment Variables" and enjoy ;)
您应该删除“环境变量”中python的旧路径并享受;)
回答by Ankur Marwaha
For me the issue was, I had installed 32 bit version on a 64 bit machine. Hope it helps someone out there.
对我来说,问题是,我在 64 位机器上安装了 32 位版本。希望它可以帮助那里的人。

