taosdata / taos-connector-python

TDengine connector for Python
https://www.taosdata.com/cn/documentation/connector#python
MIT License
46 stars 13 forks source link

Python 3.11.7 import taos就报错 win环境 #248

Open swortect opened 5 months ago

swortect commented 5 months ago

代码 conn = taos.connect( host="127.0.0.1", user="root", password="taosdata", port=6030, )

db = "power"

conn.execute(f"DROP DATABASE IF EXISTS {db}") conn.execute(f"CREATE DATABASE {db}")

change database. same as execute "USE db"

conn.select_db(db)

create super table

conn.execute( "CREATE TABLE meters (ts TIMESTAMP, current FLOAT, voltage INT, phase FLOAT) TAGS (groupid INT, location BINARY(16))" )

create table

conn.execute("CREATE TABLE d0 USING meters TAGS(0, 'Los Angles')") conn.close() exit()

报错

unable to load taos client library: Could not find module 'taos' (or one of its dependencies). Try using the full path with constructor syntax. Traceback (most recent call last): File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\taos\cinterface.py", line 51, in _load_taos_windows return ctypes.windll.LoadLibrary("taos") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\ctypes__init__.py", line 454, in LoadLibrary return self._dlltype(name) ^^^^^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\ctypes__init.py", line 376, in init__ self._handle = _dlopen(self._name, mode) ^^^^^^^^^^^^^^^^^^^^^^^^^ FileNotFoundError: Could not find module 'taos' (or one of its dependencies). Try using the full path with constructor syntax.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\taos\cinterface.py", line 57, in _load_taos_windows ctypes.windll.LoadLibrary(find_library("taos")) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\ctypes__init__.py", line 454, in LoadLibrary return self._dlltype(name) ^^^^^^^^^^^^^^^^^^^ if '/' in name or '\' in name: ^^^^^^^^^^^ TypeError: argument of type 'NoneType' is not iterable

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\taos\cinterface.py", line 72, in _load_taos return load_func[pf]() ^^^^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\taos\cinterface.py", line 59, in _load_taos_windows raise InterfaceError("unable to load taos client library: %s" % final_err) taos.error.InterfaceError: [0xffff]: unable to load taos client library: argument of type 'NoneType' is not iterable

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 1, in File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\taos__init__.py", line 2, in from taos.connection import TaosConnection File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\taos\connection.py", line 2, in from taos.cinterface import * File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\taos\cinterface.py", line 77, in _libtaos = _load_taos() ^^^^^^^^^^^^ File "C:\Users\Administrator\AppData\Local\Programs\Python\Python311\Lib\site-packages\taos\cinterface.py", line 74, in _load_taos raise InterfaceError("unable to load taos client library: %s" % err) taos.error.InterfaceError: [0xffff]: unable to load taos client library: [0xffff]: unable to load taos client library: argument of type 'NoneType' is not iterable