Macos系统下使用pymssql时报错symbol not found in flat namespace '_bcp_batch'

从2.2.0开始就有很多人遇到类似的问题,但是一直没有明确的解决方案,一直到今天在官方仓库的issue找到了有人贡献的解决方案,经过实际测试有效,所以记录一下:

 

brew install FreeTDS
export CFLAGS="-I$(brew --prefix openssl)/include"
export LDFLAGS="-L$(brew --prefix openssl)/lib -L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I$(brew --prefix openssl)/include"
pip install --pre --no-binary :all: pymssql --no-cache

具体的执行情况如下:

pip3.12 install --pre --no-binary :all: pymssql --no-cache
Collecting pymssql
Downloading pymssql-2.2.9.tar.gz (170 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 171.0/171.0 kB 1.4 MB/s eta 0:00:00
Installing build dependencies ... done(在这一步的时候耗时很久)
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: pymssql
Building wheel for pymssql (pyproject.toml) ... done
Created wheel for pymssql: filename=pymssql-2.2.9-cp312-cp312-macosx_10_9_universal2.whl size=557521 sha256=095d2145b3eb57803a27520b66a1d427506ce5b110876c656234bd2b02ec360b
Stored in directory: /private/var/folders/45/2cpq4c494459cmccx_604szm0000gn/T/pip-ephem-wheel-cache-5_da34js/wheels/e3/63/e2/b3c98260ed69b37090d9060e79bb29f8a06fbdb4d2e39f2967
Successfully built pymssql
Installing collected packages: pymssql
Successfully installed pymssql-2.2.9

posted @ 2023-10-20 02:59  AAJZ  阅读(494)  评论(0编辑  收藏  举报