广告
返回顶部
首页 > 资讯 > 后端开发 > Python >Python运行出现DeprecationWarning的问题及解决
  • 393
分享到

Python运行出现DeprecationWarning的问题及解决

2024-04-02 19:04:59 393人浏览 泡泡鱼

Python 官方文档:入门教程 => 点击学习

摘要

目录python运行出现DeprecationWarningPython版本问题出现DeprecationWarningPython运行出现DeprecationWarning 今天

Python运行出现DeprecationWarning

今天运行 py 时出现下面的问题:

DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3,and in 3.9 it will stop working

是这个语句出现的问题:

from collections import Iterable

好像是 py 版本更新以后包发生了变化,只需要改一下包名就行:

collections->collections.abc

Python版本问题出现DeprecationWarning

sklearn.cross_validation.cross_val_score()

例如:

from sklearn import cross_validation

D:\Anaconda3\lib\site-packages\sklearn\cross_validation.py:41: DeprecationWarning: This module was deprecated in version 0.18 in favor of the model_selection module into which all the refactored classes and functions are moved. Also note that the interface of the new CV iterators are different from that of this module. This module will be removed in 0.20.  "This module will be removed in 0.20.", DeprecationWarning)

改为

from sklearn.model_selection import cross_val_score

以上为个人经验,希望能给大家一个参考,也希望大家多多支持编程网。

--结束END--

本文标题: Python运行出现DeprecationWarning的问题及解决

本文链接: https://www.lsjlt.com/news/119347.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作