Reputation: 304
I have looked at other similar questions but I got no answer. I have installed pyautogui through pip install and I have checked using pip freeze and when I try to import this module I get the error "No module named 'pyautogui'". I have also tried to restart the IDE that I am using (Pycharm) and I still don't know what is going on.
Does anyone have any ideas?
Upvotes: 1
Views: 1247
Reputation: 1194
Before doing anything else, try restarting your IDE. Sometimes it's as simple as the module wasn't available when it started up.
Otherwise, it is possible that your pip
installation is running under a different version of python than the IDE you are using. Some computers come with python pre-installed, and some IDEs might install a new version as a dependency, so you can end up with two (or more) different copies of python.
The easiest solution is probably going to be to install the package from within Pycharm, which will use the same copy of python: https://www.jetbrains.com/pycharm/guide/tips/install-and-import/#:~:text=PyCharm%20can%20do%20both.,according%20to%20your%20project%20styles.
Alternatively, you can try opening the python interpreter and importing the module there:
$ python
>>> import pyautogui
If that also fails, then installing pyautogui
in the shell by running:
$ python -m pip install pyautogui
might solve it, if your IDE uses the same installation that is on your $PATH
, but not the same as pip
.
If that doesn't work, then you're going to need to figure out which python installations are being used where.
Upvotes: 2