How to Fix 'No Module Named...' Error in Python | Python Tutorial

preview_player
Показать описание
How to Fix ImportError "No Module Named pkg_name" in Python! First, download the package using a terminal outside of python. Then fix your %PATH% if needed. Troubleshoot for beginners.

To use "import pkg_name" in a script, you must INSTALL THE PACKAGE!

Installing
0:04 Option 1, use the 'Terminal' in your IDE (PyCharm)
pip3 install pkg_name OR pip install pkg_name
This installs the package in your virtual PyCharm environment

1:21 Option 2, open a terminal with your Operating System
pip3 install pkg_name OR pip install pkg_name
Also try "python -m pip3 install pkg_name"
This installs the package onto your system, accessible to all IDE's and python interpreters.

*********************************
Troubleshooting (if option 2 does not work)

2:03 Option A, check your PATH and add a new variable to it
display current path with: 'echo %PATH%'

5:32 If A doesn't work, try this: use the 'Run' application (works reliably)

**********************************

Comment below and I will help you out!
Рекомендации по теме
Комментарии
Автор

2 minutes into the video and I had already solved my problem. You sir, are a lifesaver!

jameswaweru
Автор

For others that are still having the error, the problem is that you could have selected the wrong interpreter. I highly recommend the video: "Selecting the correct Python interpreter in VSCode's Python Extension" that goes over on how to solve the issue. While the YT channel uses a Mac, the same exact process can occur with a Windows PC.

gabrielgarcia
Автор

Thank you! Since I'm a beginner, such problems are really hard to solve for me, but this tutorial is amazing and helped me a lot!

veltinius
Автор

I was trying to fix it for like a hour and a half, following some tutorials, but didn't work, but suddenly found your tutorial, and finally I was able to fix it. It was in the last way you showed, which I hadn't seen before, so thank you so much! <3

NCR_
Автор

Thank you so much Phil. Excellent tutorial for beginners like me, saved so much of my time. I subscribed.

madarauchiha
Автор

YO THIS ACTUALLY SOLVED MY PROBLEM THANK YOU SO MUCH!!

senshun.
Автор

Wow unbelievable. You solved my issue. I can't believe it. Thank you so much. I subscribed your channel.

inhwan
Автор

Thanks man, I was searching for like 2 hours and nothing helped but thanks to this video it works. I started learning Python yesterday and wanted to try out something new but the modules not working was a roadblock.

MidranKidran
Автор

FIX THAT WORKED FOR ME: when creating a new project in Pycharm you need to check the box that says 'inherit global site-packages'. Making a new project and choosing that option fixed the problem for me (if you have some files in your current project, make a new project as I explained above and move the files into the new project). If it doesn't work try restarting your pc. Hope this helps

glacialyx
Автор

nice Video Phil, keep up the great work

felix
Автор

Thanks good man, you solved my problem so easy : )

thurstein
Автор

Thanks dude this helped out a ton. You're a legend <3

WilloooIsBlue
Автор

It worked, you well deserved my like and comment man, I appreciate it 😍

SeyriSamet
Автор

hey man you helped me i didnt even think about the packages i was working on an auto typer and i was so confused with the issue thx bro.

jjkydyt
Автор

working! thanks :>
has been struggle with for making discord for more than 1 hour, and this video really helped me! thankyou very much!

mlocverm
Автор

Spent hours trying to fix the problem: "ModuleNotFoundError: No module named openpyxl". And I then was able to fix it by just watching the first 35 seconds of this video. Man, you are awesome!

sagarjainmp
Автор

MOÇO OBRIGADA SÉRIO, EU TAVA SURTANDO JÁ AQUI, EU TENTEI DE TUDO. JÁ TINHA FEITO OS PRIMEIROS MÉTODOS AI FIZ OS DOIS ÚLTIMOS E OIA DEU CERTO!!!! MEO DEOS Q ALEGRIA. EU TAVA ENTRANDO EM DEPRESSÃO JÁ. OBRIGADA MOÇO VC LACROU.

ludmiladias
Автор

the best video that I could find on youtube about this topic, thx bro

neginsalari
Автор

thanks a lot, i checked lots n lots of video but ur video helped me solving the issue

anjansiddharth
Автор

Think you very much, it is very useful for me and solved my pb; now I can easily use the package pyDecision

rokayabenjeddou