ModuleNotFoundError: No module named 'pyautogui'
This error means that your Python environment is not installedpyautogui
This module.pyautogui
It is a programmatically controlled mouse and keyboardPython modules, often usedautomationTasks, GUI testing and other scenarios.
To solve this problem, you need to install itpyautogui
Module. You can usepip
This Python package management tool is installed. On the command line (CMD) or terminal (Terminal) run the following command:
pip install pyautogui
- 1
If you are using a Python virtual environment, make sure you have activated the corresponding virtual environment and then run the above command.
If you are using a user-specific Python installation (for example, usepip3
), or you have multiple Python versions in your system, you may need to usepip3
Let's replacepip
:
pip3 install pyautogui
- 1
In some cases, you may also need administrator permissions to install the module, which can be added before the commandsudo
(existLinuxOr on Mac):
sudo pip install pyautogui
- 1
Or, if you are usingAnacondaEnvironment, can be usedconda
To install:
conda install -c conda-forge pyautogui
- 1
Once the installation is complete, you should be able to import in your Python scriptpyautogui
Module will not be encounteredModuleNotFoundError
An error. If the problem persists, please check yoursPython environment configuration, make sure you are using the correct Python interpreter, andpip
The location of the installation module matches the location of the library used by your Python interpreter.