I have already installed my wanted module from pip by using pip install but when i open up a program in idle and put import menu it says module not found what did i do wrong, im using python 3.7 and have the latest version of pip.
Asked
Active
Viewed 1.3k times
1
-
1have you created an environment for this setup? which is the pip version? – yogesh10 Aug 02 '18 at 10:39
-
1Possibly, pip and python are different versions. Try reinstalling with `python -m pip install
`. – 9769953 Aug 02 '18 at 10:41 -
Does this answer your question? [Unable to import a module that is definitely installed](https://stackoverflow.com/questions/14295680/unable-to-import-a-module-that-is-definitely-installed) – Melebius May 07 '20 at 10:03
3 Answers
4
Python looks for its modules and packages in $PYTHONPATH
. You'll need to figure out if the __init__.py
module of the package you'd like to use is in python's path. To find out whether it is in python's path, run:
import sys
print(sys.path)
within python.
To add the path to your module, run:
sys.path.append("/path/to/your/package_or_module")
and you should be set.

Sarah Strand
- 119
- 8
-
It works when I run the code with "python main.py" in the console, but the module name is still highlighted as "Not found" by VS Code, and the debugger marks it as an error. Do you know how to solve this? – Alessandro May 29 '22 at 14:00
0
I met the same problem, but in my case the package is created by myself. So this answer applyes to the custom packages. See Why customer python package can not be imported? for details.

Jingnan Jia
- 1,108
- 2
- 12
- 28
0
Just in case someone is meeting a similar problem to mine. Pay attention to the case of the package. In my case, the package is called 'shapely'. And I installed it through
pip install Shapely
But you have to import as
import shapely

U13-Forward
- 69,221
- 14
- 89
- 114

Jacob2309
- 51
- 7