我有一台带有 M3 芯片的 Mac,当我使用 python3.10^:
时出现错误File "src/pymssql/_pymssql.pyx", line 1, in init pymssql._pymssql
ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/pymssql/_mssql.cpython-312-darwin.so, 0x0002): symbol not found in flat namespace '_bcp_batch'
我的脚本:
from sqlalchemy import create_engine, text
import bi_pass
v_server = localhost
v_user = admin
v_password = 1234
v_database = mydb
source_engine = create_engine(f"mssql+pymssql://{v_user}:{v_password}@{v_server}:1433/{v_database}")
source_conn = source_engine.connect()
query = text( """ SELECT * from test""")
result = source_conn.execute(query)
rows = result.fetchall()
source_conn.close()
source_engine.dispose()
我该如何修复它?
谢谢
我找到了解决方案:
pip install --pre --no-binary :all: pymssql --no-cache --force