Pip install works but I can't import "Fer and CV2"

I have PIP installed “fer” and “opencv-python”
but I can’t import them.
My commands to install are:

	pip install opencv-python
	pip install fer

These worked.

My python code is:

import cv2
from fer import FER

Both imports do not work. They both fail with a similar error:

%Run testFer.py
Traceback (most recent call last):
File “N:\python\testFer.py”, line 1, in
import cv2
ModuleNotFoundError: No module named ‘cv2’

Please help.

Probably you have multiple Python’s installed.


  • where pip and where python to see where they are.
  • import sys and print(sys.executable) to see which one your IDE is using.
  • python -m pip instead of pip to use the pip that belongs to the active python.

I only installed Python yesterday - so i’m a noob but I got the latest version. This is what i just tried:

N:\python>where pip

N:\python>where python

N:\python>import sys + print(sys.interpreter)
‘import’ is not recognized as an internal or external command,
operable program or batch file.

Python 3.11.4 (tags/v3.11.4:d2340ef, Jun 7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)] on win32
Type “help”, “copyright”, “credits” or “license” for more information.
">>> import sys + print(sys.interpreter)
File “”, line 1
import sys + print(sys.interpreter)
SyntaxError: invalid syntax
it doesn’t how the ^ but it points to the “+”

Sorry, these should go on separate lines in the python where you get the original problem with the ModuleNotFoundError:

import sys
import cv2

Also try pip show opencv-python to confirm it was installed.

I tried that too and this is my response:

">>> import sys
">>> print(sys.interpreter)
Traceback (most recent call last):
File “stdin>”, line 1, in module>
AttributeError: module ‘sys’ has no attribute ‘interpreter’
">>> import cv2
">>> pip show opencv-python
File “stdin>”, line 1
pip show opencv-python
SyntaxError: invalid syntax (^^^ points to “show”)
">>> cv2
<module ‘cv2’ from ‘C:\Users\61403\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\cv2\init.py’>

My bad, I meant print(sys.executable).

pip show opencv-python should go on the command line, not inside python.

It looks like cv2 can be imported now. So you either fixed it or did this in a different python than before.


I can import both “cv2” and “fer” at the python prompt.

But I can’t import them in my Thonny script.

ok, i changed the Python Executable to my proper location and it complies now.