【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 命令无法安装第三方库并且出现如下问题时并出现如下问题:

可以尝试以下几种方法(在网上找了一些帖子,发现对我来说不能根本解决问题,误打误撞解决了,但不太明白原因)

一、完全关闭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
  2. File –> settings
  3. project 项目名–>Python Interpreter
  4. show all
  5. 切换到你要用jupyter的python
  6. “+” –> 搜索库名–> install

四、换个网络

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

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

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

来源:路灯下的小飞侠

物联沃分享整理
物联沃-IOTWORD物联网 » 【you may need to restart the kernel to use updated packages】

发表评论