web-dev-qa-db-fra.com

essayer d'installer pymssql sur ubuntu 12.04 en utilisant pip

J'essaie d'installer pymssql sur Ubuntu 12.04 en utilisant pip. C'est l'erreur que je reçois. Toute aide serait grandement appréciée car je suis complètement perdu!

J'ai essayé de googler cela, mais malheureusement en vain ...

  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
54
dreamwalker

Assurez-vous d'avoir le python-dev package installé (nécessaire pour compiler des packages avec des liaisons natives (merci à @ravihemnani).

Ensuite, vous devrez installer le package de développement FreeTDS (freetds-dev) avant d'essayer d'installer pymssql avec pip:

$ Sudo apt-get install freetds-dev

puis, dans votre virtualenv ou là où vous souhaitez l'installer:

$ pip install pymssql
134
Pedro Romano

En plus de freetds-dev, vous devez installer python-dev ainsi que suivre.

Sudo apt-get install python-dev

Sinon, vous serez de nouveau confronté à une erreur.

14
ravihemnani

Pour ceux sur OpenSuse (et les OS associés):

zypper in freetds-devel
pip install pymssql
3
nemesisfixx

Sur Mac

brew install [email protected]
brew link --force [email protected]
pip install pymssql
1
DhruvKalaria