Recently, I have been studying OpenCV to detect and recognize faces using C++. In order to execute source code demonstration from the OpenCV website I need to run Python to crop image first. Unfortunately, the message error is 'ImportError: No module named Image'
when I run the Python script (this script is provided by OpenCV website). I installed "python-2.7.amd64" and downloaded "PIL-1.1.7.win32-py2.7" to install Image
library. However, the message error is '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. But the message error is "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
You installed the 64-bit version of Python, but the 32-bit version of 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). There is pillow
, a PIL-compatible replacement that might work. A 64-bit version is available here:
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:
from PIL import Image
but make sure Pillow is installed. Works for me.
Try to put the python(2.7) at your Windows path. Do the following steps:
C:\\Windows;C:\\Windows\\System32;C:\\Python27
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.