Hướng dẫn python module not found
I am a beginner with Python. Before I start, here's my Python folder structure
Under
Next my
Whenever I run
Is there anything I missed?
asked May 15, 2016 at 0:08
user962206user962206 14.9k59 gold badges174 silver badges268 bronze badges 3
All modules in Python have to have a certain directory structure. You can find details here. Create an empty file called
Also in your
That should fix it P.S.: If
you are placing your answered May 15, 2016 at 0:28
4 If it's your root module just add it to
for Docker:
answered Dec 6, 2020 at 2:39
Sergey LuchkoSergey Luchko 2,7663 gold badges29 silver badges47 bronze badges 2 you need a file named
answered May 15, 2016 at 0:13
1 It's easier if you use this code
For example:
0 You need to make sure the module is installed for all versions of pythonYou can check to see if a module is installed for python by running: pip uninstall moduleName If it is installed, it will ask you if you want to delete it or not. My issue was that it was installed for python, but not for python3. To check to see if a module is installed for python3, run: python3 -m pip uninstall moduleName After doing this, if you find that a module is not installed for one or both versions, use these two commands to install the module.
answered Dec 1, 2018 at 0:09
Walker SuttonWalker Sutton 3821 gold badge4 silver badges7 bronze badges 2 After trying to add the path using:
on command prompt and using
and didn't work. Also got SSL error when trying to install the module again using conda this time instead of pip. I simply copied the module that wasn't found from the path "Mine was in
so I copied it to
answered Dec 19, 2019 at 12:40
0 Just add your project root directory to environment variable: PYTHONPATH. so for the below project structure, just add Rootdir path(For e.g: add E:\Projects\Rootdir) in PYTHONPATH.
answered Feb 23 at 21:22
I had same error. For those who run python scripts on different servers, please check if the python path is correctly specified in shebang. For me on each server it was located in different dirs. answered Jan 13, 2020 at 10:54
lpkejlpkej 4966 silver badges20 bronze badges 1 I only use Python as a secondary language and probably made a newbie-error. I had similar problem and my error was calling:
I got the error
Turns out the file I created in the same folder named "requests.py" made a conflict. Renaming the file made it work again. answered Jun 2, 2021 at 11:47
If you are using VSCode, what worked for me was I changed the interpreter of my IDE, here is a quick snapshot: I install my packages through pip3, it appears to be like my Homebrew handles all of the packages I installed previously, so that's the tweak I had to make!! answered Jun 8 at 20:33
Another solution depends on where you are running this code from. If you try running
answered Jul 5 at 16:00
Akaisteph7Akaisteph7 4,3872 gold badges14 silver badges39 bronze badges if you are using python 3 then try the below command. I was facing similar issue , this fixed my problem pip3 install answered Jan 31 at 16:05
I solved it by deleting previous python2 and only using python3 which is working fine on windows 10
answered Aug 12 at 15:32
you need to import the function so the program know what that is here is example:
i had the same problem first then i import the function and it work so i would really recommend to try it answered Apr 3, 2020 at 15:36
|