I'm trying to use the PyAutoGUI lib, and I get this error ModuleNotFoundError: No module named 'Xlib'. I have already tried sudo apt-get install python-xlib, pip3 install xlib and all the instalation commands that i have found, but no result.
This is the error I get
File "/root/.../_pyautogui_x11.py", line 7, in <module>
from Xlib.display import Display
ModuleNotFoundError: No module named 'Xlib'
Solution:
What I did finally is install the xlib library from PyCharm, and it worked.
Confirm xlib was actually installed in this folder
Python/Lib/site-packages
If it was installed, make sure the name you're importing is typed exactly as the name of the xlib folder/module. For example: if the folder is named xlib, you import this way;
from xlib.display import Display
NOT this way
from Xlib.display import Display
Related
I did:
pip install keyboard
It shows up in my file directory, however when I try and import it I get the following message:
ModuleNotFoundError: No module named 'keyboard'
I am using Python 3.10, and keyboard 0.13.5.
Any suggestions would be greatly apreciated.
As the title says, apparently VsCode doesn't recognize several modules that I already installed on my MacBook. For example,
from bs4 import BeautifulSoup
from requests import request
from tkinter import *
And the error message says,
No module named 'bs4'
File "/Users/my_name/Desktop/VsCode Projects/weather_detecter/main.py", line 7, in
<module>
from bs4 import BeautifulSoup
Also, it says the same thing on requests, but not on tkinter. I tried sudo pip, -m, pip3 on both terminal.app and VsCode terminal, but the outcome is still the same. How can I fix this?
You might need to select the correct python interpreter version first and then try importing the modules.
OR, open terminal in VS Code and try reinstalling the modules with the command python3 -m pip install <module_name>
When I try to import the module on Mu, I get the error: ModuleNotFoundError: No module named 'pyinputplus'
However, on command prompt it says its successfully installed. Im on windows 10 and using python 3.9. any help appreciated
First, you have to install that module in your computer.
By using:
pip install pyinputplus
Then, you can import it by:
import pyinputplus as pyip
and then, you will get results like this.
I'm currently doing a project on my school pc and I want to use pygame, since I have experience with pygame. I have downloaded pygame using this line in the command prompt python -m pip install -U pygame --user when I try this line python3 -m pygame.examples.aliens that is used to see if pygame is downloaded right, it works fine.
But, when I import it in the project I get this error message
File "C:/Users/user/Documents/Programming/test.py", line 10, in
import pygame
ModuleNotFoundError: No module named 'pygame'
extra info:
I use Spyder
It is a Windows pc
Thanks in advance :)
If you have used pygame before this, then have a look if you have any files named pygame.py as I had the same problem as you and my problem was naming a file the same as a core module so check that.
I have done the commands that you put and on the python3 -m pygame.examples.aliens. I got a ModuleNotFoundError: No module named 'pygame'.
When I changed the second command to python instead of python3 it worked after I installed pygame like this pip install pygame to uninstall pygame from how you did it when you install pygame change it to uninstall then try this version.
Here is the piece of code:
from PIL import Image
from pygraphics import media
toy_story = media.Movie()
I get the following error:
ImportError: No module named 'Image'
If I comment out the from pygraphics import media line it works. But then I need the media package. what's going on here. I have installed all the required packages by doing pip install <module name>. If I comment out from PIL import Image I still get the same error. What is going on here?. I have looked at other similar questions on here. But none of them answer this question.
TL;DR import media doesn't work. It gives the error ImportError: No module named 'Image'. But I have already installed Image via PIL. Help!!
I am on a mac and using python 3.5.1.
In your terminal, run python3 -m pip install <module_name>. pip has likely installed the module for python2, which you can verify by running help("modules") in python2 and python3. Running pip -V will also tell you which version of Python pip is installing modules for.