I have installed pyautogui in my PC. I my project i entered the code
import pyautogui
im1 = pyautogui.screenshot()
im1.save('my_screenshot.png')
im2 = pyautogui.screenshot('my_screenshot2.png')
It replies error message as shown below ...
Traceback (most recent call last):
File "C:/Users/rkl7cob/Desktop/autoGui.py", line 17, in <module>
import pyautogui ImportError: No module named pyautogui
That could happen because your PyAutoGui module isn't updated
pip install pyautogui --upgrade
Related
I want to import gtts. I wrote "import gtts" But it shows me a failure because he didn't know gTTS. I've already installed gtts with "pip install gtts" but it still didn't work. Please help.
Thanks
error:
PS C:\Users\dealt> & C:/Users/dealt/AppData/Local/Programs/Python/Python311/python.exe
{file}
Traceback (most recent call last):
File "c:\Users\dealt\Desktop\Durchsage.py", line 1, in <module>
import gtts
ModuleNotFoundError: No module named 'gtts'
I am trying to import gTTS
I am trying to execute handtracking module program,but I am getting this dll error while trying to import handtracking module
Program code:
import cv2
from cvzone.HandTrackingModule import HandDetector
detector=HandDetector(detectionCon=0.8)
cap =cv2.VideoCapture(0)
cap.set(3,1080)
cap.set(4,720)
while True:
sucess,img=cap.read()
img=detector.findHands(img)
lmlist,bboxinfo=detector.findPosition(img)
cv2.imshow('video',img)
cv2.waitKey(1)
Error I am getting:
Traceback (most recent call last):
File "C:/Users/Vignesh/Desktop/opencvproject/sagarmouse.py", line 3, in <module>
from cvzone.HandTrackingModule import HandDetector
File "C:\Python37\lib\site-packages\cvzone\HandTrackingModule.py", line 8, in <module>
import mediapipe as mp
File "C:\Users\Vignesh\AppData\Roaming\Python\Python37\site-packages\mediapipe\__init__.py", line 16, in <module>
from mediapipe.python import *
File "C:\Users\Vignesh\AppData\Roaming\Python\Python37\site-packages\mediapipe\python\__init__.py", line 17, in <module>
from mediapipe.python._framework_bindings import resource_util
ImportError: DLL load failed: The specified module could not be found.
Process finished with exit code 1
Did you add the required dll to your environment? If not you may add the dll to your path and restart your working environment.
You should uninstall mediapipe and install it again.
If it is not working still you should type in your terminal pip install msvc-runtime to avoid the error.
If want any other version, you visit
there ===> https://pypi.org/project/msvc-runtime/#history
Thanks.
I was using pytesseract for OCR from images. Everything was working fine .. till I tried pip install pillow and pip easy install pillow in my cmd just for trying a random crop . After that when I try to import pytesseract. It keeps throwing error
Traceback (most recent call last):
File "C:\Python39\lib\site-packages\pytesseract\pytesseract.py", line 28, in <module>
from PIL import Image
ModuleNotFoundError: No module named 'PIL'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
import pytesseract
File "C:\Python39\lib\site-packages\pytesseract\__init__.py", line 2, in <module>
from .pytesseract import ALTONotSupported
File "C:\Python39\lib\site-packages\pytesseract\pytesseract.py", line 30, in <module>
import Image
ModuleNotFoundError: No module named 'Image'
You are using Python 3.9 version. Pillow is compatible with that but only from v8. Check your pillow version. If its below 8, update it using:
>>pip install --upgrade Pillow
Moreover, if the 2nd error still persists, try this:
from PIL import Image
instead of
import Image
I try to use ImageGrab (open-cv function)
OS: lubuntu
First, I did: sudo apt-get install python-opencv.
Installation went successfuly.
Then I tried to do: from PIL import ImageGrab. But at this point I got the following ImportError:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/user/lib/python2.7/dist-packages/PIL/ImageGrab.py", line 26, in <module> import _grabscreen
ImportError: No module named _grabscreen
Where am I wrong?
Unfortunately - ImageGrab only works with Windows
Alternative: pyscreenshot
After installing the pyautogui package with pip, I tried using it in the IDLE shell by typing pyautogui.
However I get the following error:
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
pyautogui
NameError: name 'pyautogui' is not defined
I have scoured the web but have not been able to identify why IDLE will not recognise that pyautogui is installed.
Please let me know if you need more information to answer.
Have you tried importing the package first?
Try:
import pyautogui