简体   繁体   中英

How to resolve "ModuleNotFoundError: No module named 'package'" in notebook?

I installed a package in my notebook by running in a cell the following command:

!pip install packagename

but when I try to import the package, I'm getting the following error:

import packagename as pn
--> ModuleNotFoundError: No module named 'packagename'

I don't change my kernel between these commands, and also it seems installed correctly since running the install command again detects the installed package. I also tried re-installing it without success. What am I missing here?

To install any package on windows

pip install packagename

MacOS

python3 -m pip install packagename

Linux

sudo apt-get install packagename

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM