无法在Mac Sierra上安装PyoDBC或Pymssql



我正在尝试使用" pip install pyodbc"one_answers" pip install install pymsssql"安装pyodbc或pydbc或pymssql python库。但是,我不断收到以下错误消息:

Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/mz/2w0c0vc93bb2qy5rmrnxn85h0000gn/T/pip-build-upWR3q/pymssql/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/mz/2w0c0vc93bb2qy5rmrnxn85h0000gn/T/pip-DUorxp-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/mz/2w0c0vc93bb2qy5rmrnxn85h0000gn/T/pip-build-upWR3q/pymssql/

我已经安装了Freetds,尽管我在安装过程中仍会收到以下消息:

setup.py: Detected Darwin/Mac OS X.
        You can install FreeTDS with Homebrew or MacPorts, or by downloading
        and compiling it yourself.
        Homebrew (http://brew.sh/)
        --------------------------
        brew install freetds
        MacPorts (http://www.macports.org/)
        -----------------------------------
        sudo port install freetds
    setup.py: Not using bundled FreeTDS

有人知道为什么这样?我尝试了此解决方案,该解决方案和该解决方案。

这是我当前的freetds设置:

                        Version: freetds v0.91.112
         freetds.conf directory: /usr/local/Cellar/freetds@0.91/0.91.112/etc
 MS db-lib source compatibility: no
    Sybase binary compatibility: no
                  Thread safety: yes
                  iconv library: yes
                    TDS version: 7.1
                          iODBC: no
                       unixodbc: no
          SSPI "trusted" logins: no
                       Kerberos: no

我也无法安装UnixoDBC:

pip install unixodbc
Collecting unixodbc
  Could not find a version that satisfies the requirement unixodbc (from versions: )
No matching distribution found for unixodbc

请帮助?

我能够通过这样做来安装它:

  1. 使用brew install unixodbc
  2. 安装UnixODBC
  3. 安装iodbc:http://www.iodbc.org/dataspace/doc/iodbc/wiki/iodbcwiki/downloads
  4. 安装MySQL驱动程序:https://dev.mysql.com/downloads/connector/odbc/
  5. myodbc-installer -a -d -n "MySQL ODBC 5.3 Driver" -t "Driver=/usr/local/lib/libmyodbc5w.so"
  6. 添加驱动程序
  7. 请参阅/Library/ODBC/odbc.ini/Library/ODBC/odbcinst.ini已更新
  8. 现在,请指出unixoDBC的odbcinst.ini/odbc.ini文件,而是使用iodbc ini文件:
  9. sudo rm /usr/local/Cellar/unixodbc/2.3.4/etc/odbc.ini && sudo ln -s /Library/ODBC/odbc.ini /usr/local/Cellar/unixodbc/2.3.4/etc/odbc.ini
  10. sudo rm /usr/local/Cellar/unixodbc/2.3.4/etc/odbcinst.ini && sudo ln -s /Library/ODBC/odbcinst.ini /usr/local/Cellar/unixodbc/2.3.4/etc/odbcinst.ini
  11. 安装PYODBC:pip3 install pyodbc
  12. 启动Python shell(python3),并检查您可以找到驱动程序(import pyodbc;pyodbc.drivers()

我希望这可以帮助某人。

相关内容

  • 没有找到相关文章

最新更新