u011623954
u011623954
采纳率0%
2015-05-21 05:52 阅读 14.0k

关于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条回答 默认 最新

  • liwei1567 倒春寒 2016-05-16 14:48

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

    点赞 6 评论 复制链接分享
  • oyljerry oyljerry 2015-05-21 07:39
     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
    
    点赞 5 评论 复制链接分享
  • linlinhust linlinhust 2016-01-26 12:20
    点赞 评论 复制链接分享

相关推荐