Home > Net >  I installed package, but python said No moudel <name-packages> any packages I try to install i
I installed package, but python said No moudel <name-packages> any packages I try to install i

Time:07-04

I try using pip and pip3 and python -m pip and all ways to install. The terminal says the packages already installed after the first try to install, but when I try to import the package I had error no moudel name.

enter image description here

enter image description here

enter image description here

I feel the peoblem coming form here enter image description here

But I am not sure

And when I go to packages in pycharm I saw the packages not installed

enter image description here

I appreciate your help

CodePudding user response:

I'm assuming you're using windows.

It looks like you install the package directly in your system and PyCharm are using a virtual environment to run your code.

Try to activate this virtual environment before run your code:

source venv\Scripts\activate

If you see "(venv)" at the begging of your terminal prompt the virtual environment are activated.

Run pip list to check what packages are installed in there and probably you have to install your package another time, this time in your activated virtual environment. The official documentation will help to understand how and why use virtual environments.

After that you can try to run your code directly from the terminal:

python your_file.py

CodePudding user response:

Install the packages from PyCharm itself, not the terminal as I think pycharm is running a virtual environment.

Maybe you can follow https://www.jetbrains.com/help/pycharm/installing-uninstalling-and-upgrading-packages.html#packages-tool-window

  • Related