-1

So, I'm a bit new to python and have mastered javascript. I know that javascript modules are saved in node_modules folder in a directory

I did: $ pip install pyautogui

but when I'm about to run my code, it says :

'Traceback (most recent call last):
  File "bruh.py", line 1, in <module>
    import pyautogui, time
ImportError: No module named pyautogui'

where do python modules get saved to? 'python_modules' folder?????

also, idk what to do, can anyone help me with this error?

dejanualex
  • 3,872
  • 6
  • 22
  • 37
  • 1
    pip module location varies by OS distribution. Also may want to specify pip and python version. python can be aliased to anything and so can pip. For instance on my machine python is symlinked to python2.4, python3 symlinked to 3.7. If I want to install a module for python3.8 I have to do pip3.8 install and run the 3.8 interpreter. – OneLiner Oct 23 '20 at 14:38
  • Does this answer your question? [Installed module using pip, not found](https://stackoverflow.com/questions/40834656/installed-module-using-pip-not-found) – Pranav Hosangadi Oct 23 '20 at 14:39
  • @PranavHosangadi, im using a Windows 10 machine – ZintDaMint Oct 25 '20 at 14:53
  • @PranavHosangadi, im using a Windows 10 machine – ZintDaMint Oct 25 '20 at 14:54
  • @PranavHosangadi, im using a Windows 10 machine – ZintDaMint Oct 25 '20 at 14:55

2 Answers2

1

To see the path where your modules are saved once you pip them.

You can open a python shell, import sys and print the sys.path variable. One of the path would end with site-packages, thats the path where modules are saved.

$ python3
>>> import sys
>>> print(sys.path)
[‘’, ‘/Users/uname/.local/lib/python3.6/site-packages/‘]
ATIF ADIB
  • 571
  • 5
  • 10
  • But why does it say that theres no module witht that name? – ZintDaMint Oct 25 '20 at 14:52
  • You might have multiple versions of python on your system, the best way to pip would be to use the command “python3 -m pip install pyautogui” this way you are sure that pip is saving the modules in a place which is reachable from python3. – ATIF ADIB Oct 25 '20 at 17:35
0

could be a number of things. do you have multiple versions of python on your machine? If so you'd need to pip install to the correct python version, e.g.: pip3 install pyautogui vs pip install pyautogui