解决方案
查看自己的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客户端