Unable to install pyodbc on Linux

前端 未结 18 1975
野趣味
野趣味 2020-11-28 05:23

I am running Linux (2.6.18-164.15.1.el5.centos.plus) and trying to install pyodbc. I am doing pip install pyodbc and get a very long list of errors, which end in

相关标签:
18条回答
  • 2020-11-28 05:40

    I faced with same issue. For python3.6.8 and ubuntu 16.04 none of above did not help me.

    sudo apt-get install python3.6-dev
    

    This solved my problem.

    0 讨论(0)
  • 2020-11-28 05:42

    Struggled with the same issue

    After running: sudo apt-get install unixodbc-dev

    I was able to pip install pyodbc

    0 讨论(0)
  • 2020-11-28 05:43

    I have referenced this question several times, and gone on to actually find the answer I was looking for here: pyodbc wiki

    To avoid gcc error on Ubuntu Linux, I did:

    sudo aptitude install g++
    

    I also installed the following 2 packages from Synaptic:

    • python-dev

    • tdsodbc

    0 讨论(0)
  • 2020-11-28 05:43

    For archlinux/manjaro:

    sudo pacman -S unixodbc
    

    then:

    sudo pip install pyodbc
    

    or:

    pip install pyodbc
    

    You can upgrade your pip wheel setuptools before installing pyodbc (it won't affect the pyodbc installation) also with:

    sudo python -m pip install --upgrade pip wheel setuptools
    

    or

    python -m pip install --upgrade pip wheel setuptools
    
    0 讨论(0)
  • 2020-11-28 05:44

    A easy way to install pyodbc is by using 'conda'. As conda automatically installs required dependencies including unixodbc.

    conda --ugrade all (optional)

    then conda install pyodbc

    it will install following packages:

    libgfortran-ng: 7.2.0-hdf63c60_3 defaults mkl: 2018.0.3-1 defaults mkl_fft: 1.0.2-py36_0 conda-forge mkl_random: 1.0.1-py36_0 conda-forge numpy-base: 1.14.5-py36hdbf6ddf_0 defaults pyodbc: 4.0.17-py36_0 conda-forge unixodbc: 2.3.4-1 conda-forge

    0 讨论(0)
  • 2020-11-28 05:45

    In my case (Amazon Linux AMI) none of the above worked. The following worked (idea from here):

    • Find the path to the file cc1plus. For me it was in /usr/libexec/gcc/x86_64-amazon-linux/4.8.5/cc1plus. For you it may vary a bit. Try ls -l /usr/libexec/gcc to find the proper directory name and go ahead.
    • Find directories in your path: echo $PATH (for me it was /sbin:/bin:/usr/sbin:/usr/bin:/opt/aws/bin)
    • Put a link to cc1plus in one of the directories in your PATH: sudo ln -s /PATH/TO/cc1plus /DIRinPATH/
      For example in my case:
      sudo ln -s /usr/libexec/gcc/x86_64-amazon-linux/4.8.5/cc1plus /usr/bin/
    0 讨论(0)
提交回复
热议问题