Pyautogui not importing "No module named 'pyautogui' "

13,299

Why are you getting this error?

Because you are using PyCharm.

In PyCharm you don't need to install python packages from command prompt, in PyCharm you need to install python packages from PyCharm Project Interpreter.

Here are some tips that can help you!

Step 1: Go to PyCharm settings and go to this directory: Preferences and select Interpreter Settings

Screenshot:

enter image description here

Step 2: Click on this plus icon.

Screenshot:

enter image description here

Step 3: Type your package name and select package.

Screenshot:

enter image description here

Step4: Then click on install button.

enter image description here

Step 5: Click on okay

Then wait for two to three minutes and try again.

Hopefully it'll work.

Share:
13,299
Admin
Author by

Admin

Updated on June 04, 2022

Comments

  • Admin
    Admin almost 2 years
    import pyautogui
    
    print("hello")
    

    After running this I am presented with the following:

    C:\Users\Darkm\Anaconda3\envs\PythonChallenges\python.exe C:/Users/Darkm/PycharmProjects/PythonChallenges/Automation1.py
    Traceback (most recent call last):
      File "C:/Users/Darkm/PycharmProjects/PythonChallenges/Automation1.py", line 1, in <module>
        import pyautogui
    ModuleNotFoundError: No module named 'pyautogui'
    
    Process finished with exit code 1
    

    Could somebody help me understand why I cannot import pyautogui?

    Some background information:

    1.) I only have one version of python (3.7.4)

    2.) I have already installed the module through "pip install pyautogui" in cmd prompt.

    3.) Pyautogui is installed under C:\Users\Darkm\Anaconda3\Lib\site-packages

    4.) Pyautogui does not show up when I go into file > settings > project interpreter and try to add it manually (it just doesn't show up).

    5.) Have restarted computer multiple times

    At this point I cannot figure out why I'm unable to import pyautogui, any help would be greatly appreciated!