I have a Python file that I want to convert to .exe using pyinstaller.
I get this error,
I searched how to solve this and the solution was to install Pillow package. After I installed it, I face the same error again and I don't know what else to do.
Some versions of PIL have an exposed Image class. Try this:
import Image
You can get more info on this from the official tutorial.
Related
I have a problem when I try to convert a .py file to .exe. I get the ModuleNotFoundError error, specifically with the playsound module. I've made sure to have it installed (with pip list) and, just in case, I've tried uninstalling it and installing a more stable version following the advice of a forum and it's still the same. The program works perfectly but when converting it to .exe (using auto-py-to-exe) it tells me that it can't find the playsound module. Has anyone had the same problem?
Fixed! The problem was that I had multiple versions of python installed and the modules were conflicting.
Hi everyone what I'm trying to do is to make python recognize this picture just the number 96 in a white background. and to show me a "96" in string, that's all.
For that purpose I have installed pytesseract into python using the command prompt (pip install pytesseract), I also have installed Pil (which is pillow now, and also installed it using command prompt), Tesseract OCR engine is also installed on my computer, I downloaded it and installed it, is in my environmental variables (typing the path command in the command prompt it shows me Tesseract-OCR), and finally I also downloaded the pytesser, unzipped the file to the directory: C:\Python27\Lib. Almost forgot to mention, the version of python I have is 2.7.12 and the OpenCV version installed is 3.1.0.
What I did, is to run the following script:
from PIL import Image
import pytesseract
img=Image.open('E:\Alex2016\Python OpenCV\Scripts\imagenFinal.jpg')
a=pytesseract.image_to_string(img)
print(a)
img.show()
And it only shows me the image but no "96" string. I'm new at this guys, I don't even know if I'm really using the Tesseract-OCR which I know is a super powerful engine for these things. I'm runing my script in the python shell. I have to mention also that I couldn't be able to make pytesser work, because when trying to "import pytesser" or doing "from pytesser import *" like I've seen in other sites, I get this error
import pytesser
ImportError: No module named pytesser
I think this image is pretty understandable and noisy free, so guys if you could tell me how I can detect numbers with these tools or if there is any other that could make this, thanks a lot for your time guys I'm new at this stuff but I'm really interested on this field of science, the computer vision technology.
I'm getting an error while using PyCharm which doesn't allow me to import the pillow module even though I have it installed as a package in the project interpreter. Any help is greatly appreciated!
http://imgur.com/a/DfjC3
While the name of the package is pillow, it is a replacement for PIL and uses the PIL for the name of the base module
the usual way to use pillow is
from PIL import Image
im = Image.open("filename")
See the tutorial, and the documentation
You try to run code with default Python interpreter (/Library/Frameworks/Python.framework/Versions/3.2/bin/python3). You need to configure PyCharm to run Your code with anaconda (~/anaconda/bin/python)
And now (Like #JamesK say) read Pillow tutorial and documentation:
import PIL not import Pillow
For anybody still having trouble with this, I did the following which solved my problem.
Open up your Project Interpreter (⌘ + , on Mac).
At the bottom of this page you'll see the + symbol to the left of the anaconda logo. This will create a pop-up that allows you to search for available packages.
In this new window, search for 'Pillow'.
Click and Install Package.
You should now be able to use "from PIL import Image" or "import Pillow as pil" etc.
After running this command on your terminal
pip install pillow
and you are sure it was installed, but still having same problem of PIL module not found.
Go to your IDE and make sure existing interpreter is set to python interpreter and not anaconda
I am working through a few Python image tutorials. It seems that the greatest challenge every time I try something new in Python is just getting it to work! I have imported the PIL code and am trying to run the short snippet below in Spyder on Python 2.7.8
from PIL import Image
from pylab import *
im = array(Image.open('test.jpg'))
imshow(im)
show()
When I do so, I get "Image data can not convert to float" error.
I tried to do the same in an iPython notebook and received the same error. When I run pip freeze it shows that I have PIP 1.1.7 installed. Of note, I installed PIP using the executable at the host site, not with PIP. I am also using the Spyder instance that comes with Anaconda.
Any advice?
After trying other solutions posted I discovered that PIL may be out of date with my newer Python build (see link in comments). Once Pillow was installed the issue was resolved.
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:
Pillow-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:
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:
Open System Properties (Win+Pause) or My Computer and right-click then Properties
Switch to the Advanced tab
Click Environment Variables
Select PATH in the System variables section
Click Edit
Add python's path to the end of the list (the paths are separated by semicolons).
example C:\Windows;C:\Windows\System32;C:\Python27