关于python安装pymssql报错,求大神指点,在ubuntu14.04下

报错内容:

 (pyenvdata)lin@lin-ThinkPad:~$ pip install pymssql
Downloading/unpacking pymssql
  Downloading pymssql-2.1.1.tar.gz (2.4MB): 2.4MB downloaded
  Running setup.py (path:/home/lin/pyenvdata/build/pymssql/setup.py) egg_info for package pymssql
    setup.py: platform.system() => 'Linux'
    setup.py: platform.architecture() => ('64bit', 'ELF')
    setup.py: platform.linux_distribution() => ('Ubuntu', '14.04', 'trusty')
    setup.py: platform.libc_ver() => ('glibc', '2.4')
    setup.py: Not using bundled FreeTDS
    setup.py: include_dirs = ['/usr/local/include']
    setup.py: library_dirs = ['/usr/local/lib']

    Installed /home/lin/pyenvdata/build/pymssql/setuptools_git-1.1-py2.7.egg

Installing collected packages: pymssql
  Running setup.py install for pymssql
    setup.py: platform.system() => 'Linux'
    setup.py: platform.architecture() => ('64bit', 'ELF')
    setup.py: platform.linux_distribution() => ('Ubuntu', '14.04', 'trusty')
    setup.py: platform.libc_ver() => ('glibc', '2.4')
    setup.py: Not using bundled FreeTDS
    setup.py: include_dirs = ['/usr/local/include']
    setup.py: library_dirs = ['/usr/local/lib']
    building '_mssql' extension
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include -I/usr/include/python2.7 -c _mssql.c -o build/temp.linux-x86_64-2.7/_mssql.o -DMSDBLIB
    _mssql.c:314:22: fatal error: sqlfront.h: 没有那个文件或目录
     #include "sqlfront.h"
                          ^
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    Complete output from command /home/lin/pyenvdata/bin/python -c "import setuptools, tokenize;__file__='/home/lin/pyenvdata/build/pymssql/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-c75p_h-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/lin/pyenvdata/include/site/python2.7:
    setup.py: platform.system() => 'Linux'

setup.py: platform.architecture() => ('64bit', 'ELF')

setup.py: platform.linux_distribution() => ('Ubuntu', '14.04', 'trusty')

setup.py: platform.libc_ver() => ('glibc', '2.4')

setup.py: Not using bundled FreeTDS

setup.py: include_dirs = ['/usr/local/include']

setup.py: library_dirs = ['/usr/local/lib']

running install

running build

running build_ext

building '_mssql' extension

creating build

creating build/temp.linux-x86_64-2.7

x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include -I/usr/include/python2.7 -c _mssql.c -o build/temp.linux-x86_64-2.7/_mssql.o -DMSDBLIB

_mssql.c:314:22: fatal error: sqlfront.h: 没有那个文件或目录

 #include "sqlfront.h"

                      ^

compilation terminated.

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------
Cleaning up...
Command /home/lin/pyenvdata/bin/python -c "import setuptools, tokenize;__file__='/home/lin/pyenvdata/build/pymssql/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-c75p_h-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/lin/pyenvdata/include/site/python2.7 failed with error code 1 in /home/lin/pyenvdata/build/pymssql
Traceback (most recent call last):
  File "/home/lin/pyenvdata/bin/pip", line 11, in <module>
    sys.exit(main())
  File "/home/lin/pyenvdata/local/lib/python2.7/site-packages/pip/__init__.py", line 185, in main
    return command.main(cmd_args)
  File "/home/lin/pyenvdata/local/lib/python2.7/site-packages/pip/basecommand.py", line 161, in main
    text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe6 in position 46: ordinal not in range(128)

3个回答

安装前尝试下面命令
export PYMSSQL_BUILD_WITH_BUNDLED_FREETDS=1

 You need to install the FreeTDS development package (freetds-dev) before trying to install pymssql with pip:

$ sudo apt-get install freetds-dev
and then, in your virtualenv or wherever you wish to install it:

$ pip install pymssql
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐