当前位置:网站首页>Jupyter import Package Failed

Jupyter import Package Failed

2022-07-23 05:11:00 orajamie

Here are two examples I use pycharm Medium jupyter Examples of packages that cannot be introduced when , Make a note here , In case you forget what to do in case of the same situation in the future , If you have the same situation, you can try , Lightning protection together .

import imblearn Failure resolvent

close vpn:

I have installed DevSidecar, You need to close to continue to the next step , Other situations are not clear .

operation

1、 stay jupyter Write the following two lines of code :

import sys
sys.path

see jupyter Mode of python Compile path .

Output results :

['F:\\COMPETITION\\C2',
 'F:\\COMPETITION\\C2',
 'D:\\Anaconda\\Anaconda2\\python38.zip',
 'D:\\Anaconda\\Anaconda2\\DLLs',
 'D:\\Anaconda\\Anaconda2\\lib',
 'D:\\Anaconda\\Anaconda2',
 '',
 'C:\\Users\\SCAU-Action\\AppData\\Roaming\\Python\\Python38\\site-packages',
 'D:\\Anaconda\\Anaconda2\\lib\\site-packages',
 'D:\\Anaconda\\Anaconda2\\lib\\site-packages\\win32',
 'D:\\Anaconda\\Anaconda2\\lib\\site-packages\\win32\\lib',
 'D:\\Anaconda\\Anaconda2\\lib\\site-packages\\Pythonwin',
 'D:\\Anaconda\\Anaconda2\\lib\\site-packages\\IPython\\extensions',
 'C:\\Users\\SCAU-Action\\.ipython',
 'D:\\pythonprofessional\\PyCharm 2021.1\\plugins\\python\\helpers\\pydev',
 'D:\\pythonprofessional\\PyCharm 2021.1\\plugins\\python\\helpers-pro\\jupyter_debug']

Actually, I don't know which line to look at , But I found that most of the paths are under this path

D:\\Anaconda\\Anaconda2\\lib\\site-packages

2、 Open this path , I got inspiration from the following blogger's article , Find out jupyter Of kernel route , Although I don't see it intuitively in my path ipykernel, But you can find it in the path above .

jupyter Unable to import The solution of the new package ( If there is any infringement, please inform to delete )

Then I found out ipykernel Also under the path above :
 Insert picture description here
stay windows Of cmd Enter this path

D:\\Anaconda\\Anaconda2\\lib\\site-packages

Re execution pip command

pip install imblearn

I wrote it because I have successfully installed it , So there is no cut-off picture for the installed appearance ...

End of this part .

import matplotlib Failure resolvent

open vpn?

( The expression of this title may not be quite right , But I won't . It's strange , The upper one should be closed , Open this ...)
I need to open it here DevSidecar, To move on , Other situations are not clear .

operation

1、 open Anaconda Prompt

The operation is similar to that of this blogger :

Jupyter Run magic in %matplotlib inline error ModuleNotFoundError: No module named ‘matplotlib‘( If there is any infringement, please inform to delete )

2、 First of all activate Your virtual environment , And then again pip.

Here I compare dishes , I don't know what my virtual environment is , After I lost threeorfour wrong virtual environments ,prompt Remind me that I can use the following command to view the existing environment ( It's really smart, hee hee ).

conda info -e

Output results :
 Insert picture description here
3、activate The environment in the above results , Then proceed pip.

activate D:\Anaconda\Anaconda2
pip install matplotlib

If no accident , Get it done .

原网站

版权声明
本文为[orajamie]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/204/202207221753328469.html