当我在导入sklearn这个库的时候,程序抛出了一个丢弃警告,它的意思是在版本更新后imp库已经不用了,用importlib来代替这个库

Warning (from warnings module):
  File "C:\Users\33171\AppData\Local\Programs\Python\Python37\lib\site-packages\sklearn\externals\joblib\externals\cloudpickle\cloudpickle.py", line 47
    import imp
DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses

因此解决方案就是把它的文件路径copy下来,C:\Users\33171\AppData\Local\Programs\Python\Python37\lib\site-packages\sklearn\externals\joblib\externals\cloudpickle

打开它,然后把cloudpickle.py文件里面的

import imp  -->改成  import importlib

from __future__ import print_function

import dis
from functools import partial
import importlib #更改之前是 import imp
import io
import itertools
import logging
import opcode
import operator
import pickle
import struct
import sys
import traceback
import types
import weakref

预览

DeprecationWarning的更多相关文章

  1. 解决: DeprecationWarning: Passing 1d arrays as data is deprecated in 0.17 and will raise ValueError in 0.19

    错误信息:C:\Python27\lib\site-packages\sklearn\utils\validation.py:395: DeprecationWarning: Passing 1d a ...

  2. DeprecationWarning: Calling an asynchronous function without callback is deprecated. - how to find where the “function:” is?

    I recently updated my node to 7.2.1 and noticed that there is a warning coming: (node:4346) Deprecat ...

  3. Python提示AttributeError 或者DeprecationWarning: This module was deprecated解决方法

    Python提示AttributeError 或者DeprecationWarning: This module was deprecated解决方法 在使用Python的sklearn库时,发现sk ...

  4. DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks` instead extract-text-webpack-plugin 提取css报错

    深入浅出Webpack 1-5 使用pulugin extract-text-webpack-plugin 提取css报错 DeprecationWarning: Tapable.plugin is ...

  5. 解决如下出错:DeprecationWarning: Passing 1d arrays as data is deprecated in 0.17 and willraise ValueError in 0.19.

    背景:在Spyder中写几行脚本,目的是应用sklearn自带的svm(支持向量机)算法,来对其自带的digits(手写体数字)数据集进行分类,过程包括训练阶段和预测阶段.将手写体数字数据的特征数据d ...

  6. node.js开发错误——DeprecationWarning: Mongoose: mpromise

    原文地址 使用mongoose进行数据库操作时,总是提示: (node:5684) DeprecationWarning: Mongoose: mpromise (mongoose's default ...

  7. [未解决]报错:DeprecationWarning: decodestring() is a deprecated alias since Python 3.1, use decodebytes()

    DeprecationWarning: decodestring() is a deprecated alias since Python 3.1, use decodebytes()

  8. mongoose报错:DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes instead.

    mongoose报错:(node:15689) DeprecationWarning: collection.ensureIndex is deprecated. Use createIndexes ...

  9. DeprecationWarning:'open()' is deprecated in mongoose>=4.11.0,use 'openUri()' instead or set the 'useMongoClient' option if using 'connect()' or 'createConnection'

    mongoose.connect('mongodb://localhost/test');报错:(node:2752) DeprecationWarning: `open()` is deprecat ...

随机推荐

  1. 关于OSI

    OSI模型,即开放式通信系统互联参考模型(Open System Interconnection,OSI/RM,Open Systems Interconnection Reference Model ...

  2. JavaScript 浏览器中的事件

    1.事件的基本概念 事件是指在文档或者浏览器中发生的一些特定交互瞬间,比如打开某一个网页,浏览器加载完成后会触发 load 事件,当鼠标悬浮于某一个元素上时会触发 hover 事件,当鼠标点击某一个元 ...

  3. 【转载】 spring事物配置,声明式事务管理和基于@Transactional注解的使用

    https://blog.csdn.net/bao19901210/article/details/41724355

  4. VritualBox安装CentOS及安装增强工具图文教程

    一  VM VirtualBox VirtualBox可在官网https://www.virtualbox.org/下载,完全免费. 二  安装CentOS系统(以CentOS6.9为例) 1.Cen ...

  5. Unity RigidBodyFPSController 鼠标不显示

    做第一人称浏览和顶视图浏览时遇到一个坑,就是当切换到第一人称时,操作UI界面的时候就gg,鼠标光标都看不见了. 如下图:LockCursor LockCursor 做了两个操作,第一个就是锁定光标位置 ...

  6. 安装Mosquitto学习MOTT协议

    1.源码的获取:http://mosquitto.org/files/source/ 2.直接解压tar文件,就可以得到所有的源码,里面有个配置文件config.mk,这个文件包含了Mosquitto ...

  7. MongoDB4.0 WINDOWS环境下 副本集、分片部署

    部署开始: 创建路径 D:\Program Files\MongoDB\MySet下 config Data log 文件夹 config文件夹下准备配置文件: 分片1的副本集1 storage: d ...

  8. 14. Encryption tools (加密工具 8个)

    SSH(Secure Shell)现在是无处不在的程序,用于在远程机器上登录或执行命令. 它通过不安全的网络在两个不受信任的主机之间提供安全的加密通信,取代了可怕的不安全的telnet / rlogi ...

  9. centos7进单用户

    当重启linux系统,进入系统选择页面的时候,按e 在linux16那一行最后面添加 init=/bin/sh 按ctrl+c 挂载根分区,可读写 mount / -o rw, remount

  10. [noip2016]洛谷2827

    来一发文字证明~ 数据范围很大... 如果用priority_queue搞的话肯定是会t的. 所以肯定要想一想优化的思路. 我们发现,对于队列来讲,同加,减是不改变这个队列的大小关系的: 但是呢,切开 ...