由于之前的bug已经解决了,不得不网上找个图来替代一下。我也是出现了类似问题,没有名叫xxx的模块存在。解决这个问题的办法很简单,出现这种问题大概率就是jupyter的配置环境与pycharm中的环境不一样。
1、查看jupyter安装路径
import sys
path = sys.executable
print(path)
再看看自己pycharm里的环境配置,哇塞果然是不一样的,两个不同的配置环境必然无法正确导包。一种方法是更改配置环境的路径(jupyter无法导入已安装的包?原因竟是它! - 知乎),另一种就是在jupyter路径下重新安装环境。
C:\Users\Administrator>python
Python 3.9.6 (tags/v3.9.6:db3ff76, Jun 28 2021, 15:26:21) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> quit()
C:\Users\Administrator>pip install opencv-python pillow matplotlib scipy pandas scikit-learn tqdm scikit-image imutils PyYAML seaborn easydict ipython -i https://mirrors.aliyun.com/pypi/simple/
一次性装完所有包
opencv-python pillow matplotlib scipy pandas scikit-learn
tqdm scikit-image imutils PyYAML seaborn easydict