How to fix ModuleNotFoundError: No module named in Python

Answered
Jan 05, 2026 1866 views 1 answers
45

I installed a package with pip but Python says "ModuleNotFoundError: No module named". I've tried reinstalling but it still doesn't work.

P
Asked by python_dev
Platinum 447 rep

1 Answer

12

This is a common issue usually related to Python environments. Here are the solutions:

Check which Python is being used

# Check Python path
which python
which python3
# Check pip path
which pip
which pip3

Install to correct Python

# Use python -m pip to ensure correct pip
python3 -m pip install package-name
# Or specify full path
/usr/bin/python3 -m pip install package-name

Virtual environment solution

# Create and use virtual environment
python3 -m venv venv
source venv/bin/activate
pip install package-name
S
Answered by security_pro 1 week, 2 days ago
Bronze 259 rep

Your Answer

You need to be logged in to answer questions.

Log In to Answer

Related Questions

Hot Questions

No hot questions available.