mac 安装pymssql 报错 ERROR: Command errored out with exit status 1:

mac 安装pymssql 报错 ERROR: Command errored out with exit status 1:

报错信息

ERROR: Command errored out with exit status 1:
     command: /Users/1/anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/nf/kf7vkbkx42nbmf39vc_m8bpc0000gn/T/pip-install-xmqmyhfu/pymssql/setup.py'"'"'; __file__='"'"'/private/var/folders/nf/kf7vkbkx42nbmf39vc_m8bpc0000gn/T/pip-install-xmqmyhfu/pymssql/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/nf/kf7vkbkx42nbmf39vc_m8bpc0000gn/T/pip-record-7ctemtpc/install-record.txt --single-version-externally-managed --compile --install-headers /Users/1/anaconda3/include/python3.6m/pymssql
         cwd: /private/var/folders/nf/kf7vkbkx42nbmf39vc_m8bpc0000gn/T/pip-install-xmqmyhfu/pymssql/
    Complete output (35 lines):
    /Users/1/anaconda3/lib/python3.6/site-packages/setuptools/dist.py:44: DistDeprecationWarning: Do not call this function
      warnings.warn("Do not call this function", DistDeprecationWarning)
    setup.py: platform.system() => 'Darwin'
    setup.py: platform.architecture() => ('64bit', '')
    setup.py: platform.libc_ver() => ('', '')
    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
    setup.py: include_dirs = ['/usr/local/include', '/opt/local/include']
    setup.py: library_dirs = ['/usr/local/lib', '/opt/local/lib']
    running install
    running build
    running build_ext
    cythoning src/_mssql.pyx to src/_mssql.c
    warning: src/_mssql.pyx:150:4: Exception already a builtin Cython type
    building '_mssql' extension
    creating build
    creating build/temp.macosx-10.7-x86_64-3.6
    creating build/temp.macosx-10.7-x86_64-3.6/src
    gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/1/anaconda3/include -arch x86_64 -I/Users/1/anaconda3/include -arch x86_64 -I/usr/local/include -I/opt/local/include -I/Users/1/anaconda3/include/python3.6m -c src/_mssql.c -o build/temp.macosx-10.7-x86_64-3.6/src/_mssql.o -DMSDBLIB
    src/_mssql.c:567:10: fatal error: 'sqlfront.h' file not found
    #include "sqlfront.h"
             ^~~~~~~~~~~~
    1 error generated.
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /Users/1/anaconda3/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/nf/kf7vkbkx42nbmf39vc_m8bpc0000gn/T/pip-install-xmqmyhfu/pymssql/setup.py'"'"'; __file__='"'"'/private/var/folders/nf/kf7vkbkx42nbmf39vc_m8bpc0000gn/T/pip-install-xmqmyhfu/pymssql/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/nf/kf7vkbkx42nbmf39vc_m8bpc0000gn/T/pip-record-7ctemtpc/install-record.txt --single-version-externally-managed --compile --install-headers /Users/1/anaconda3/include/python3.6m/pymssql Check the logs for full command output.
(base) 

解决方法

Homebrew (http://brew.sh/)
        --------------------------
        brew install freetds
    
        MacPorts (http://www.macports.org/)
        -----------------------------------
        sudo port install freetds

成功安装pymssql


$ pip install pymssql
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting pymssql
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/2e/81/99562b93d75f3fc5956fa65decfb35b38a4ee97cf93c1d0d3cb799fffb99/pymssql-2.1.4.tar.gz (691 kB)
Building wheels for collected packages: pymssql
  Building wheel for pymssql (setup.py) ... done
  Created wheel for pymssql: filename=pymssql-2.1.4-cp36-cp36m-macosx_10_7_x86_64.whl size=287039 sha256=0a2cef004fddde22608bdad33e16b527d96d19961462673a01cfbf52c366924f
  Stored in directory: /Users/1/Library/Caches/pip/wheels/b9/65/b1/470c4b56b7162ef4deded12c67b25297755781efab03b21119
Successfully built pymssql
Installing collected packages: pymssql
Successfully installed pymssql-2.1.4
(base) 

你可能感兴趣的:(日常报错,linux,anaconda)