Python ошибка при запуске приложения 0xc000007b

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:Pythonpython

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:Pythonpython 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:PythonvirtualenvenvScripts activate

env is the [environment name] here.

If you activate it, every command will look like:

(env) C:Pythonpython

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.

Это, вероятно, не ответит на ваш вопрос, но мой ответ для очень конкретного случая, когда вы «обновляете Windows, не затрагивая файлы», чтобы исправить ваш ПК с Windows 8.1.

Если вы это сделаете, вы получите эту ошибку при попытке запустить Python после обновления Windows.

Чтобы исправить эту ошибку, просто переустановите PY в той же папке, где ваш python был установлен, прежде чем обновлять окна. Если вы попытаетесь установить его в любую другую папку, такую ​​как имя пользователя /appdata/…, установщик PY застрял бы в инициализации.

Вы также можете получить еще одну ошибку: «api-ms-win-crt-runtime-l1-1-0.dll отсутствует». Чтобы исправить ошибку, перейдите в папку windows.old и получите файл dll с указанным выше именем и вставьте его в папку PY. Также, как и другие, предложили, чтобы был установлен дистрибутив Microsoft Visual Studio 2015.

Обход этой ошибки после обновления Windows настолько редок, что никто, похоже, не испытал в соответствии с поисковыми запросами Google, поэтому, хотя я поделился им с этим редким несчастным человеком.

Originally created by: btcoooo…@gmail.com

What steps will reproduce the problem?
1. Fresh installs of 3.3.2.1 or 3.3.2.0.
2. IPython, SPyder, WinPython shortcuts crash silently.
3. Double-click on python.exe in python-3.3.2.amd64 folder.

What is the expected output? What do you see instead?
Python.exe won’t start on my work desktop; raises a 0xc000007b error. But it works on my personal laptop.

What version of the product are you using? On what operating system?
64-bit 3.3.2.1 or 3.3.2.0 crash on my Windows 7 Pro work desktop.
64-bit 3.3.2.0 works on my Windows 7 Home laptop (haven’t tried 3.3.2.1).
64-bit 2.7.5.1 works on both machines.
32-bit versions work on both machines.

Please provide any additional information below.
Used Dependency Walker to find that MSVCR100.dll in the python-3.3.2.amd64 folder is a 32-bit version. Downloaded the MS redistributable package to get a 64-bit version, copied it into the above folder, and now everything appears to work (although it sometimes takes a second attempt). Perhaps my laptop was able to use the correct DLL from a different location.

score:0

Like many have said, Windows cannot load python.exe itself or one of its dependent DLLs because of INVALID_IMAGE_FORMAT:

  • python.exe is of unsupported bitness. 32bit on 64bit Windows is supported. 64bit on 32bit system is not (solution: install 32bit python, bye).

  • python.exe or one of its DLLs is corrupted (probably not)

  • one of the dependent DLLs is not of the same bitness as the EXE:

    1. python.exe (say, 32bit) requires python*.dll (python3.dll or python27.dll). It installs that into Windows System32/SysWOW64 folder. The DLL is of correct bitness (32bit).

    2. Something else overwrites that with 64-bit version, or places a 64-bit version somewhere in the search PATH.

    3. When you run python.exe (32bit), Windows searches for python*.dll, and the first one it founds is the 64bit one. 32bit EXEs cannot normally load 64bit DLLs.

Typical examples:

  • TortoiseHg installs its own copy of python (both .exe and .dll) into its own folder and adds itself to PATH. The bitness can be different (say, 64bit) and usually matches platform bitness.

  • Another installation of Python with a different bitness somewhere else overwrites the DLL (it shouldn’t, they have different System32s, but who knows)

Diagnostics:

  • Dependency Walker marks 64bit DLLs with 64bit icons. Verify that icons for python.exe and python*.dll match. Right click -> «Show full paths» to see where the DLL is taken from.

Simple solutions:

  1. Maybe you have another, functioning copy of Python somewhere else? Check it.

  2. Reinstall Python, preferably in the platform version (64bit for 64bit OS, 32bit for 32bit) Yeah, that’s what many are saying, but now you know why this is needed.

  3. Remove offenders from PATH. While this maaaay fix your Python, this will break the offenders and some (TortoiseHg explorer plugins) need the PATH. So maybe compromise with them and choose #2.

score:0

In my case I was installing both the 32 and 64 bit versions of the python msi. They both install to the same folder, c:python32. I thought msi’s would prevent those kinds of conflicts, but no.

Some more answer related to the same question

  • «Unicode Error «unicodeescape» codec can’t decode bytes… Cannot open text files in Python 3
  • Cannot Open Python. Error 0xc000007b
  • Error 1181: cannot open input file ‘m.lib’ with Python 3.5.1
  • installing Gdal on Windows 10 with python 3.6.4: fatal error C1083: Cannot open include file: ‘cpl_port.h’
  • python: error while loading shared libraries: libpython3.4m.so.1.0: cannot open shared object file: No such file or directory
  • Python urllib3 error — ImportError: cannot import name UnrewindableBodyError
  • Spark Python error «FileNotFoundError: [WinError 2] The system cannot find the file specified»
  • Cannot install lxml on windows, fatal error C1083: Cannot open include file: ‘libxml/xmlversion.h’
  • Can’t install matplotlib : fatal error C1083: Cannot open include file: ‘ft2build.h’: No such file or directory
  • libffi-d78936b1.so.6.0.4: cannot open shared object file Error on AWS Lambda function

score:1

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.

score:1

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

Related question

  • Selenium Python (3.141.0, Geckodriver 0.30.0) can’t open Firefox Webdriver: «Your Firefox profile cannot be loaded It may be missing or inaccessible.»
  • How to fix error while loading shared libraries: «libpython3.6m.so.1.0: cannot open shared object file: No such file or directory»?
  • PyCharm error — Error loading project: Cannot load facet Python
  • Python Error just on PC startup sqlite3.OperationalError: unable to open database file
  • snappy/snappymodule.cc(31): fatal error C1083: Cannot open include file: ‘snappy-c.h’: No such file or directory
  • How to fix —— ./darknet: error while loading shared libraries: libcudart.so.10.0: cannot open shared object file: No such file or directory
  • cannot open resource: OS Error
  • LINK : fatal error LNK1181: cannot open input file ‘db2cli64.lib’
  • gdbm error 22 when performing Python shelve open
  • Error : OSError: libmediainfo.so.0: cannot open shared object file: No such file or directory

score:1

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

I had the same problem ..

score:1

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:Pythonpython

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:Pythonpython 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:PythonvirtualenvenvScripts activate

env is the [environment name] here.

If you activate it, every command will look like:

(env) C:Pythonpython

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.

score:1

For me the issue was, I had installed 32 bit version on a 64 bit machine. Hope it helps someone out there.

score:2

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.

score:3

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

score:6

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.

score:10

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.

Related Query

  • ImportError: libarrow.so.14: cannot open shared object file: No such file or directory | python
  • ‘TypeError: ‘float’ object cannot be interpreted as an integer’ error in Python 3.7.1 when coding a simple GAN
  • Error with using cython «fatal error C1083; Cannot open include file: ‘io.h’: No such file or directory»
  • Python tornado OS Error 24 Too many open files
  • Syntax error:unicode error on trying to open image using PIL in Python
  • Cannot find error in Python code
  • Error while using open function in python 3.8.0
  • I can open a jupyter notebook, but I cannot run the notebook with python script in it on my Mac
  • Python error ‘numpy.float64’ object cannot be interpreted as an integer
  • Cannot open Jupyter notebook using Anaconda python 3.6.1
  • python open directory error
  • Not Able to Open Python File, IDLE Error Python 3.9.1
  • Import error in python sklearn. Cannot load referenced library
  • Error when trying to open url in python jupyter
  • ‘str’ object cannot be interpreted as an integer : Python error
  • How do i fix ‘TypeError: cannot unpack non-iterable numpy.float64 object’ error in python
  • Q: python (using cutadapt in bash script on cluster): libpython3.7m.so.1.0: cannot open shared object file: No such file or directory
  • Cannot figure out this error in python 3Traceback (most recent call last): File «<stdin>», line 1, in <module> NameError: name ‘xlrd’ is not defined
  • Python gets an error in ODE function: Cannot cast array data from dtype(‘complex128’) to dtype(‘float64’)
  • Cannot open JSON file used both load and loads command in python
  • Cannot read image with See3CAM with Python 3 and open CV
  • When installing Kivy on Windows 10, error message «fatal error C1083: Cannot open include file: ‘GL/glew.h’: No such file or directory»
  • Permission error when attempting to open a .bat file written to by the same code in python
  • Syntax error on print with Python 3
  • Multiprocessing causes Python to crash and gives an error may have been in progress in another thread when fork() was called
  • Error in Python script «Expected 2D array, got 1D array instead:»?
  • Python 3.7 anaconda environment — import _ssl DLL load fail error
  • Why doesn’t Python give any error when quotes around a string do not match?
  • Python webbrowser.open() to open Chrome browser
  • Python 3 urllib produces TypeError: POST data should be bytes or an iterable of bytes. It cannot be of type str

More Query from same tag

  • cannot properly import the chatterbot and its corpus
  • How to use pyInstaller to completely pack all the necessary Library?
  • How to check if Iterable_1 in iterable_2
  • incompatible signature with supertype — abstractmethods vs Liskov for enforcing naming
  • Python’s format doesn’t work with text containing JSON
  • Simple password check with limited retries
  • Selenium WebDriver: finding a button using button mode
  • Extracting Groups
  • Grant access to Vertica SQL Tables to everyone using Python
  • Kalman Filter returns magnified estimates
  • python string input to integer conversion
  • Make XML code from request data and inserting to database
  • Traceback (most recent call last) when docx.Document() is used
  • Classify Text with Gensim LDA Model
  • How to know the number of remaining input items in multiprocessing?
  • Selenium explicit wait with relative XPath locator
  • How can I vectorize or optimize a function to reduce the time taken in python?
  • Skimage Polygon function: Why does the last vertice repeats in the polygon documentation example?
  • Python 3.6 cx_freeze ModuleNotFoundError: No module named Tkinter
  • what is the difference between «eval» and «int»
  • Python Scrapy — service_identity(opentype) not working and cannot install
  • Label the plot legend with the classes in that column
  • Neither DSN nor SERVER keyword supplied
  • How to delete data from array and then interpolate over that gap in python?
  • Python 3. — Why aren’t my logical operators (‘and’, ‘or’) not working?
  • comparing values in a list to create a dictionary?
  • How to make a multiple trace plot as a reusable code?
  • Python OOP — Change class text
  • Why is this variable not counting as intended?
  • Weird behavior of pyperclip
  • Pymongo finding all Mongo records where value is between two mongo index values
  • Can’t get webpage to load when on Selenium Chrome Driver and tried years old solutions, need new one
  • Solving environment: | Found conflicts! Looking for incompatible packages. The updating is eternal
  • Getting full path from the relative path with Argparse
  • Counter sorting lost when combined with defaultdict

@adabo

I followed all the steps and everything seemed to install correctly. There were no errors installing python 3.3.5 ,pip, or python neovim. Finally I unzipped NeoSFML and ran the exe and this was the error:

---------------------------
neosfml.exe - Application Error
---------------------------
The application was unable to start correctly (0xc000007b). Click OK to close the application. 
---------------------------
OK   
---------------------------

I’m on Windows 10 64bit

Do I unzip the neosfml anywhere? How can I verify everything installed properly? I have checked the Path variable User variables for adabao not System variables. There is c:Python33 and C:toolsneovimNeovimbin. Am I missing something?

@some-mthfka

I compiled on Windows 7 x64, so the OS is probably not the problem.
Unzipping is necessary, but the place where you do it does not matter.

Could you, please, do the following things and see what happens?
From the command prompt (Win + R), run:

python

then

nvim

If these two work (are found, that is), then it would help to see the output of neosfml.exe itself:

cd NeoSFML/build_windows
neosfml

Since neovim is unstable, I would not be surprised to find out that API has changed. In this case, I am not sure when I can investigate, since I don’t even have a Windows machine now.

If you are looking for a neovim front end for work and not for experiments, I would suggest using neovim-qt. I will soon update readme to warn about this.

@adabo

Win+R > python > nvim says:

Python 3.3.5 (v3.3.5:62cf4e77f785, Mar  9 2014, 10:35:05) [MSC v.1600 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> nvim
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'nvim' is not defined
>>>

I can call nvim from Win+R and cmd, however.

Since neovim is unstable, I would not be surprised to find out that API has changed. In this case, I am not sure when I can investigate, since I don’t even have a Windows machine now.

Not a problem. I’m content using GVim. Truth be told I am just looking for a c++ autocomplete, syntax check, and snippets. I use Visual Studio Community to build/run. I prefer GVim as my editor, but out-of-the-box it is lacking these key features that I want.

If you are looking for a neovim front end for work and not for experiments, I would suggest using neovim-qt. I will soon update readme to warn about this.

I’ve tried many times over neovim’s development cycle to make the switch, but I could not. The occasional bugs or errors really sucks the life out of the coding experience.

To be honest, I really don’t know understand completely what your project is or intends to do. I just gave it my best shot to get it up and running.

I’d be willing to assist if you would like.

@some-mthfka

I can call nvim from Win+R and cmd, however.

This is in fact what I was wondering about 👍

I googled for the 0xc000007b error — proposed fixes vary from running as admin to running chkdsk. Maybe there is something wrong with the zip file (packing, downloading, unpacking). Anyway, since python and nvim are found, it would still be nice to see what the output of neosfml.exe is.

cd NeoSFML/build_windows # or wherevere it is
neosfml.exe

This might hint at the root of the problem, at this point I am just curious what went wrong.

To be honest, I really don’t know understand completely what your project is or intends to do.

This project was a milestone to Viy — basically Vim with pictures. I use emacs now.

I use Visual Studio Community to build/run.

You could compile straight from vim — it can show you all the errors and you could jump to them.

I just gave it my best shot to get it up and running.

Thank you for that : ) And sorry that it didn’t work.

@adabo

There is no output in cmd:

Microsoft Windows [Version 10.0.16299.125]
(c) 2017 Microsoft Corporation. All rights reserved.

C:UsersSkooch>cd C:UsersSkoochDownloadsneosfml

C:UsersSkoochDownloadsneosfml>neosfml.exe

C:UsersSkoochDownloadsneosfml>

It’s just the window with the previously mentioned error message.

I read this from your Viy readme:

I did not figure out how to embed visuals in an elegant way.

Hahah but does it work? Can’t you just revisit it later?

@some-mthfka

Sure, the embedding of pictures works. But it isn’t elegant — I prefer to think that API was not meant for what I had in mind, but maybe I missed something. Anyway, Emacs has pics and I am a happy man : )

There is no output in cmd:

Hmm, alright. Thank you for your cooperation!

@adabo

  • Python ошибка ввода данных
  • Python завершить программу при ошибке
  • Python ошибка typeerror int object is not iterable
  • Pyqt сообщение об ошибке
  • Python если ошибка то действие