Cannot Open Python. Error 0xc000007b

19

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.

After installing it, I went to open up Python CLI and GUI and no luck. It gave me this error.

"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.

python
windows
python-3.x
asked on Stack Overflow Dec 18, 2013 by user3113898 • edited Dec 18, 2013 by m01

9 Answers

7

That is the NTSTATUS error 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.

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.

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.

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.

answered on Stack Overflow Dec 18, 2013 by David Heffernan
4

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.

1

As janne-karila mentioned, and for Python 3.5, Microsoft Visual Studio 2015 redistributable (in this case the 64 bit version)

answered on Stack Overflow Oct 11, 2016 by Efren • edited May 23, 2017 by Community
1

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.

If you do that, You'd get this error when you try to run Python after the windows refresh.

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.

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.

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.

answered on Stack Overflow Sep 25, 2017 by MarcelineH
0

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 thread suggest.

This stackoverflow question also looks like it has some useful information.

answered on Stack Overflow Dec 18, 2013 by m01 • edited May 23, 2017 by Community
0

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).

answered on Stack Overflow Nov 6, 2017 by Ram Vallabh Singh
0

Simply, download the last version of Microsoft Visual C++ redistributable package ..

I had the same problem ..

answered on Stack Overflow Feb 10, 2018 by Ghanem
0

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.

First, install python normally. Copy, the Python.exe path. In my case, it is

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:

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:

C:\Python\virtualenv\env\Scripts activate

env is the [environment name] here.

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.

Also, to deactivate the environment same deactivate.bat is in the scripts folder.

answered on Stack Overflow Mar 18, 2018 by Himanshu_Singh_PM
0

you should delete the old path of python in "Environment Variables" and enjoy ;)


User contributions licensed under CC BY-SA 3.0