How to solve "Module not found: Unable to import module" error in python.
1 minute read
How to solve "Module not found: Unable to import module" error in python.
1. Install the required module.
Python will not be able to import any module unless it is not installed. To install any module in python, open command prompt and type "pip install 'module name' ".
2. Add site-packages to environment variables path.
It might happen that the python directory "site-packages" is not added to your environment variables. To do so, follow these steps.
1. Open "search" and type in environment variables.
2.Click on "Edit system environment variables".
3. Click on "Environment Variables" in the bottom right corner.
4. Now in the window that appears, click on "New" under user variables.
5. Add the following path: "C:\Users\Username\Appdata\Programs\Python\Python38\Libs\site-packages".
6. Replace username with your username and python 38 with the version you are using.
7. Save this setting and relaunch your code editor.
Post a Comment