解决使用InfluxDBClient报错influxdb.exceptions.InfluxDBClientError: 401 unauthorized

解决方案

查看自己的InfluxDB数据库版本,如果版本是1.8+或是2.x,则:

首先卸载influxdb

pip uninstall influxdb

然后安装:

pip install 'influxdb-client[ciso]'

后续使用influxdb-client来连接数据库

问题解析

在原先influxdb-python的github页面:https://github.com/influxdata/influxdb-python,提到了:

Note: This library is for use with InfluxDB 1.x. For connecting to InfluxDB 2.x instances, please use the the influxdb-client-python client.

适用于v2版本的客户端工具influxdb-client-python,github页面:https://github.com/influxdata/influxdb-client-python

这个influxdb-client-python是专门应用于InfluxDB 2.0的python客户端

猜你喜欢

转载自blog.csdn.net/weixin_35757704/article/details/129209726