Modulenotfounderror is an Error that you will get when you have not installed the package in your system. Are you getting the error modulenotfounderror: no module named pyautogui then this post is for you. In this entire tutorial, you will know how to solve this issue in a simple way.
What is PyAutoGUI?
PyAutoGUI is a python package that allows you to simulate mouse cursor moves and clicks. It also simulates keyboard button presses. You can say that this package allows you to programmatically control the keyboard and mouse and automate the UI testing.
Cause of the modulenotfounderror: no module named pyautogui
The root cause of the modulenotfounderror: no module named pyautogui is that you have not installed the PyAutoGUI package in your system. How you will know that it is not installed in your system. The answer is that when you try to import the pyautogui package and run it then you will get the modulenotfounderror: no module named pyautogui error.
If you are using the Pycharm IDE then you will get the underline below the pyautogui word. The python interpreter is telling you that you have not installed that package in your system.
The same error you will see when you try to import the pyautogui package in terminal or command prompt.
Solve the modulenotfounderror: no module named pyautogui Error
The solution for the no module named pyautogui is very simple you have to install the pyautogui package in your system. To install you have to use the pip3 or pip command.
Use the pip3 command if your python version is 3. xx and the pip command if you are using the python 2. xx version.
Open your terminal or command prompt and use the below command.
Python 3. xx
pip3 install PyAutoGUI Python 2.xx
pip install PyAutoGUI
Now if you import the pyautogui package then you will not get any module named pyautogui error.
PyAutoGUI python package is very useful for automatic control of your keyboard and mouse. If you are getting theno module named pyautogui error then the above method will solve your problem.
Please let me know if you are unable to solve the issue.