[英]Python 2.7 - ImportError: No module named Image
Recently, I have been studying OpenCV to detect and recognize faces using C++. 最近,我一直在研究使用C ++检测和识别面部的OpenCV。 In order to execute source code demonstration from the OpenCV website I need to run Python to crop image first.
为了从OpenCV网站执行源代码演示,我需要先运行Python来裁剪图像。 Unfortunately, the message error is
'ImportError: No module named Image'
when I run the Python script (this script is provided by OpenCV website). 不幸的是,当我运行Python脚本时,消息错误是
'ImportError: No module named Image'
(此脚本由OpenCV网站提供)。 I installed "python-2.7.amd64" and downloaded "PIL-1.1.7.win32-py2.7" to install Image
library. 我安装了“python-2.7.amd64”并下载了“PIL-1.1.7.win32-py2.7”来安装
Image
库。 However, the message error is 'Python version 2.7 required, which was not found in the registry'
. 但是,消息错误是
'Python version 2.7 required, which was not found in the registry'
。 And then, I downloaded the script written by Joakim Löw for Secret Labs AB / PythonWare to register registry in my computer. 然后,我下载了JoakimLöw为Secret Labs AB / PythonWare编写的脚本,以便在我的计算机中注册注册表。 But the message error is
"Unable to register. You probably have the another Python installation"
. 但消息错误是
"Unable to register. You probably have the another Python installation"
。
I spent one month to search this issue on the internet but I cannot find the answer. 我花了一个月的时间在互联网上搜索这个问题,但我找不到答案。 Please support me to resolve my issue.
请支持我解决我的问题。
Thanks, Tran Dang Bao 谢谢,Tran Dang Bao
You installed the 64-bit version of Python, but the 32-bit version of PIL. 您安装了64位版本的Python,但是安装了32位版本的PIL。 Either switch to the 32-bit version of Python , or you need a 64-bit version of PIL (not available that I could find).
要么切换到32位版本的Python ,要么需要64位版本的PIL(我找不到它)。 There is
pillow
, a PIL-compatible replacement that might work. 有
pillow
,兼容PIL的替代品可能有效。 A 64-bit version is available here: 这里有64位版本:
Pillow-2.1.0.win-amd64-py2.7.exe 枕头2.1.0.win-AMD64-py2.7.exe
The solution is very simple. 解决方案非常简单。 You don't need to worry about x86 or 64 bit, all you have to do is import as follows:
您不必担心x86或64位,您只需按以下方式导入:
from PIL import Image
but make sure Pillow is installed. 但请确保已安装枕头。 Works for me.
适合我。
Try to put the python(2.7) at your Windows path. 尝试将python(2.7)放在Windows路径上。 Do the following steps:
执行以下步骤:
C:\\Windows;C:\\Windows\\System32;C:\\Python27
C:\\Windows;C:\\Windows\\System32;C:\\Python27
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.