【you may need to restart the kernel to use updated packages】

@pip insatll 命令安装不上第三方库

you may need to restart the kernel to use updated packages

当在jupyter中用pip install 命令无法安装第三方库并且出现如下问题时并出现如下问题:

【you may need to restart the kernel to use updated packages】
可以尝试以下几种方法(在网上找了一些帖子,发现对我来说不能根本解决问题,误打误撞解决了,但不太明白原因)

; 一、完全关闭Jupyter

  1. 把jupyter的网页、后台、 全部关闭,如果你用的是Anaconda 那么把anaconda这个后台也退出。
  2. 完全退出后 重新进入jupyter 网页
  3. pip install 库名 安装。

二、cmd 命令

  1. win+R 输入cmd 进入终端
  2. 命令行切换到你使用的jupyter本身的python库的目录下
    (切换盘 D: 、进入子目录: cd 文件夹名 )
  3. 使用pip install 库名 安装

三、用pycharm

这是我尝试了其他方法都没用后的结果,特别麻烦,但是没想到能安装上。

  1. 进入pycharm
    【you may need to restart the kernel to use updated packages】
  2. project 项目名–>Python Interpreter
    【you may need to restart the kernel to use updated packages】
  3. show all
    【you may need to restart the kernel to use updated packages】
  4. 切换到你要用jupyter的python
  5. “+” –> 搜索库名–> install
    【you may need to restart the kernel to use updated packages】
    【you may need to restart the kernel to use updated packages】

; 四、换个网络

如果错误的最下方出现
内联代码片

//pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.

可以尝试换个网络,也许下载太慢

Original: https://blog.csdn.net/weixin_49049930/article/details/124742093
Author: 路灯下的小飞侠
Title: 【you may need to restart the kernel to use updated packages】

原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/729121/

转载文章受原作者版权保护。转载请注明原作者出处!

(0)

大家都在看

亲爱的 Coder【最近整理,可免费获取】👉 最新必读书单  | 👏 面试题下载  | 🌎 免费的AI知识星球