鱼C论坛

 找回密码
 立即注册
查看: 2627|回复: 3

关于这个警告如何处理?

[复制链接]
发表于 2020-3-10 19:29:35 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
本帖最后由 Ds萝卜 于 2020-3-10 19:31 编辑

警告:
  1. Warning (from warnings module):
  2.   File "C:\Users\Administrator\Desktop\regr.py", line 1
  3.     import pymssql #引入pymssql模块
  4. DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working
复制代码


python:3.7

源码:
  1. import pymssql #引入pymssql模块

  2. def conn():
  3.     connect = pymssql.connect('172.16.78.10', 'sa', '123456', 'WX4') #服务器名,账户,密码,数据库名
  4.     if connect:
  5.         print("连接成功!")
  6.     return connect

  7. if __name__ == '__main__':
  8.     conn = conn()
复制代码


  1. C:\Users\Administrator>pip list
  2. Package    Version
  3. ---------- -------
  4. pip        20.0.2
  5. pymssql    2.1.4
  6. setuptools 39.0.1
复制代码


小甲鱼最新课程 -> https://ilovefishc.com
回复

使用道具 举报

发表于 2020-3-10 21:07:59 From FishC Mobile | 显示全部楼层
大致意思就是说,你引用了一个过时的方法
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2020-3-11 07:59:40 | 显示全部楼层
用 pymysql
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2020-3-11 10:57:19 | 显示全部楼层
弃用警告:从collections中导入ABCs已被弃用,并在python3.8中将停止工作,可使用collections.abc代替它进行使用
换个导入方式就行,如果用的是pycharm这类IDE,可以自动帮你改正
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-7-4 09:33

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表