Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/308.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 尝试使用pip在Ubuntu12.04上安装pymssql_Python_Ubuntu_Ubuntu 12.04_Pip_Pymssql - Fatal编程技术网

Python 尝试使用pip在Ubuntu12.04上安装pymssql

Python 尝试使用pip在Ubuntu12.04上安装pymssql,python,ubuntu,ubuntu-12.04,pip,pymssql,Python,Ubuntu,Ubuntu 12.04,Pip,Pymssql,我正在尝试使用pip在Ubuntu12.04上安装pymssql。这就是我得到的错误。任何帮助都将不胜感激,因为我完全迷路了 尝试用谷歌搜索,但不幸的是没有用 Downloading pymssql-2.0.0b1-dev-20130403.tar.gz (2.8Mb): 2.8Mb downloaded Running setup.py egg_info for package pymssql warning: no files found matching '*.pyx' u

我正在尝试使用pip在Ubuntu12.04上安装pymssql。这就是我得到的错误。任何帮助都将不胜感激,因为我完全迷路了

尝试用谷歌搜索,但不幸的是没有用

  Downloading pymssql-2.0.0b1-dev-20130403.tar.gz (2.8Mb): 2.8Mb downloaded
  Running setup.py egg_info for package pymssql
    warning: no files found matching '*.pyx' under directory 'Cython/Debugger/Tests'
    warning: no files found matching '*.pxd' under directory 'Cython/Debugger/Tests'
    warning: no files found matching '*.h' under directory 'Cython/Debugger/Tests'
    warning: no files found matching '*.pxd' under directory 'Cython/Utility'
    Compiling module Cython.Plex.Scanners ...
    Compiling module Cython.Plex.Actions ...
    Compiling module Cython.Compiler.Lexicon ...
    Compiling module Cython.Compiler.Scanning ...
    Compiling module Cython.Compiler.Parsing ...
    Compiling module Cython.Compiler.Visitor ...
    Compiling module Cython.Compiler.FlowControl ...
    Compiling module Cython.Compiler.Code ...
    Compiling module Cython.Runtime.refnanny ...

    Installed /home/radek/build/pymssql/Cython-0.19.1-py2.7-linux-x86_64.egg
    cc -c /tmp/clock_gettimeh7sDgX.c -o tmp/clock_gettimeh7sDgX.o
    cc tmp/clock_gettimeh7sDgX.o -lrt -o a.out

    warning: no files found matching 'win32/freetds.zip'
Installing collected packages: pymssql
  Running setup.py install for pymssql
    skipping '_mssql.c' Cython extension (up-to-date)
    building '_mssql' extension
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/home/radek/build/pymssql/freetds/nix_64/include -I/usr/include/python2.7 -c _mssql.c -o build/temp.linux-x86_64-2.7/_mssql.o -Wno-parentheses-equality -DMSDBLIB
    gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-x86_64-2.7/_mssql.o -L/home/radek/build/pymssql/freetds/nix_64/lib -lsybdb -lct -lrt -o build/lib.linux-x86_64-2.7/_mssql.so
    /usr/bin/ld: cannot find -lct
    collect2: ld returned 1 exit status
    error: command 'gcc' failed with exit status 1
    Complete output from command /usr/bin/python -c "import setuptools;__file__='/home/radek/build/pymssql/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-Et_P1_-record/install-record.txt:
    running install

running build

running build_ext

skipping '_mssql.c' Cython extension (up-to-date)

building '_mssql' extension

creating build

creating build/temp.linux-x86_64-2.7

gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/home/radek/build/pymssql/freetds/nix_64/include -I/usr/include/python2.7 -c _mssql.c -o build/temp.linux-x86_64-2.7/_mssql.o -Wno-parentheses-equality -DMSDBLIB

creating build/lib.linux-x86_64-2.7

gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-x86_64-2.7/_mssql.o -L/home/radek/build/pymssql/freetds/nix_64/lib -lsybdb -lct -lrt -o build/lib.linux-x86_64-2.7/_mssql.so

/usr/bin/ld: cannot find -lct

collect2: ld returned 1 exit status

error: command 'gcc' failed with exit status 1

----------------------------------------
Command /usr/bin/python -c "import setuptools;__file__='/home/radek/build/pymssql/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-Et_P1_-record/install-record.txt failed with error code 1

确保安装了
python dev
软件包(需要编译带有本机绑定的软件包(感谢@ravihemnani)

然后,您需要先安装FreeTDS开发包(
FreeTDS dev
),然后再尝试使用pip安装
pymssql

$ sudo apt-get install freetds-dev
然后,在您的virtualenv中或您希望安装它的任何地方:

$ pip install pymssql

除了freetds-dev之外,您还需要安装python-dev并遵循以下步骤

sudo apt-get install python-dev
否则,您将再次面临一些错误。

对于OpenSuse(及相关操作系统)上的用户:

在Mac上


如果pip不起作用:sudo apt get install python pip将安装pipsudo apt get install-y freetds dev解决了我的问题。谢谢。debian和apt get install freetds dev中的相同问题也解决了我的问题!我需要
导出C_INCLUDE_PATH=/usr/INCLUDE
。这也对我的Raspberry Pi起到了作用,但是我必须以root用户身份安装PymSQL
sudopip3安装pymssql
因为我得到了一个权限错误:[Errno 13]权限被拒绝:'/usr/local/lib/python3.5/dist-packages/_-mssql.cpython-35m-arm-linux-gnueabihf。所以“这是可搜索的:Ubuntu 14.04将抛出”mssql.c:346:22:致命错误:sqlfront.h:没有这样的文件或目录”。安装freetds dev将根据下面的答案修复此问题。此评论对于使接受的评论成功至关重要!(至少在14.04LTS中)谢谢,Ravihemnani
zypper in freetds-devel
pip install pymssql
brew install freetds@0.91
brew link --force freetds@0.91
pip install pymssql