Glam Prestige Journal

Bright entertainment trends with youth appeal.

I've been trying to look for a solution online for hours with no avail.

I have this piece of code:

#load packages
import pyautogui #these are for our clicks and keystrokes!
import time #required to call any time commands (i.e delay)
#STEP ONE --> Get Cursor Location
time.sleep(2)
prin
t(pyautogui.position())

But everytime I try to run this script I get the following error:

/usr/bin/python3.9 "/home/silo/Documents/Python Projects/macro 1.py"
Traceback (most recent call last): File "/home/silo/Documents/Python Projects/macro 1.py", line 2, in <module> import pyautogui #these are for our clicks and keystrokes!
ModuleNotFoundError: No module named 'pyautogui'
Process finished with exit code 1

This is what happens when I try to install any package in settings:1

I am currently using:

  1. Elementary OS 5.1.7 Hera
  2. Ubuntu 18.04.4 LTS
  3. Python 3.9.5
  4. Pip 9.0.1 (I have already upgraded pip to latest version via terminal, though I think this is still for Python 3.6)

I've tried (but to no success):

  • Installing pyautogui, pillow, plotly, matplotlib
  • Changing pyCharm's Python interpreter to /usr/bin/python3.9 (strangely, pyCharm names this path Python 3.6)
  • Removed all instances of Python 2.7
  • alias = 'Python 3.9'
  • export PATH="$PATH:/path/to/dir"
  • Installed everything with: $ python3 -m pip <...>

1 Answer

suggests

python3 -m pip install pyautogui

but have you tried

pip3 install pyautogui

it might help.

I would not recommend removing python2 as Ubuntu still needs it to patch itself.

The difficulty is in setting up the right environment to separate whatever it is you want to do with pyautogui from other functional parts of the system.

That's where package management systems like anaconda really excel.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy