pip fails to install PIL or Pillow with mt.exe error

此生再无相见时 提交于 2019-12-20 15:25:37

问题


On one of my Windows 7 development machines, I am attempting to install the Python Image Library.

My machines are similar. Both run Windows 7 Professional, x64. Both use Python 2.7.3 (32bit). On one of the machine pip install PIL works fine. On the other it fails with the trace ending with this:

build\temp.win-amd64-2.7\Release\_imaging.pyd.manifest : general error c1010070:
 Failed to load and parse the manifest. The system cannot find the file specified.

error: command 'mt.exe' failed with exit status 31

How can I resolve this error?


回答1:


Thanks to http://bugs.python.org/issue4431, this error was fixed by modifying:

C:\<Python dir>\Lib\distutils\msvc9compiler.py

and adding:

 ld_args.append('/MANIFEST')

after the MANIFESTFILE line so it looks like:

        # Embedded manifests are recommended - see MSDN article titled
        # "How to: Embed a Manifest Inside a C/C++ Application"
        # (currently at http://msdn2.microsoft.com/en-us/library/ms235591(VS.80).aspx)
        # Ask the linker to generate the manifest in the temp dir, so
        # we can embed it later.
        temp_manifest = os.path.join(
                build_temp,
                os.path.basename(output_filename) + ".manifest")
        ld_args.append('/MANIFESTFILE:' + temp_manifest)
        ld_args.append('/MANIFEST')

If you still get the error, then change the if arg.startswith("/MANIFESTFILE:") to if arg.startswith("/MANIFEST:") in the manifest_get_embed_info(self, target_desc, ld_args) method.




回答2:


Download the compressed package from pypi, and try building and installing in your machine. This link could give you some hints. That exactly deals with your problem only but the installation varies.




回答3:


If you've reached here looking for

general error c1010070:
 Failed to load and parse the manifest. The system cannot find the file specified.

error: command 'mt.exe' failed with exit status 31

Here's a workaround that worked in Windows 8/x64/Python 3.3/VS 11:

# py 3.3 seems to be compiled against VS 2010 compiler, force using VS11 cl.exe for us
$env:VS100COMNTOOLS=$env:VS110COMNTOOLS

# Modify C:\Python33\lib\distutils\msvc9compiler.py
# Comment line 670:         ld_args.append('/MANIFESTFILE:' + temp_manifest)
# Basically it will instruct build to not look for manifest file


来源:https://stackoverflow.com/questions/12418735/pip-fails-to-install-pil-or-pillow-with-mt-exe-error

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