How to install pymssql on MacOS Sierra

后端 未结 2 1520
终归单人心
终归单人心 2021-02-13 12:15
Command \"/usr/bin/python -u -c \"import setuptools, tokenize;__file__=\'/private/tmp/pip-build-J1I0ox/pymssql/setup.py\';f=getattr(tokenize, \'open\', open)(__file__);c         


        
2条回答
  •  被撕碎了的回忆
    2021-02-13 12:55

    As of Feb 2021

    I can no longer install freetds@0.91 as homebrew does not have it available. The current version of freetds is 1.2.18 and brew link --force freetds doesn't seem to change anything.

    The root issue 'sqlfront.h' file not found is due to the freetds files not linking properly during installation. We can fix this by doing

    export LDFLAGS="-L/opt/homebrew/opt/freetds/lib"
    export CPPFLAGS="-I/opt/homebrew/opt/freetds/include"
    pip install pymssql
    

    Where /opt/homebrew/opt/freetds is where homebrew installed freetds on your system (I am on Apple Silicon) and may be different for you. If you are on Intel your's might look something like /usr/local/opt/freetds.

    To find exactly where homebrew installed freetds (or any program for that matter) on your system, you can do

    brew --prefix freetds
    

    This should return something like /opt/homebrew/opt/freetds or /opt/homebrew/opt/freetds@1.2.18. You can ignore any version numbers and append /lib and /include to get the paths you need.

    This is a handy trick to keep in mind as it is applicable to lots of other install issues with dependencies installed via homebrew.

提交回复
热议问题