如何在服务器中安装pyodbc python库?

问题描述

我有 python 3.8,我正在尝试安装 pyodbc 库来连接 sql server 但出现错误。请帮我如何安装它?有没有其他库可以连接Sql Server

我正在使用以下命令 -

python3 -m pip install pyodbc

我遇到的错误-

Collecting pyodbc
  Using cached pyodbc-4.0.30.tar.gz (266 kB)
Building wheels for collected packages: pyodbc
  Building wheel for pyodbc (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/local/bin/python3 -u -c 'import sys,setuptools,tokenize; sys.argv[0] = '"'"'/tmp/pip-install-fnygoose/pyodbc_7db1b044e510447c8352fe2f54d4cbe0/setup.py'"'"'; __file__='"'"'/tmp/pip-install-fnygoose/pyodbc_7db1b044e510447c8352fe2f54d4cbe0/setup.py'"'"';f=getattr(tokenize,'"'"'open'"'"',open)(__file__);code=f.read().replace('"'"'\r\n'"'"','"'"'\n'"'"');f.close();exec(compile(code,__file__,'"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-67s6uwc7
       cwd: /tmp/pip-install-fnygoose/pyodbc_7db1b044e510447c8352fe2f54d4cbe0/
  Complete output (10 lines):
  running bdist_wheel
  running build
  running build_ext
  building 'pyodbc' extension
  creating build
  creating build/temp.linux-x86_64-3.7
  creating build/temp.linux-x86_64-3.7/src
  gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPYODBC_VERSION=4.0.30 -I/app/python3.7.4/include/python3.7m -c src/buffer.cpp -o build/temp.linux-x86_64-3.7/src/buffer.o -Wno-write-strings
  gcc: error trying to exec 'cc1plus': execvp: No such file or directory
  error: command 'gcc' Failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for pyodbc
  Running setup.py clean for pyodbc
Failed to build pyodbc
Installing collected packages: pyodbc
    Running setup.py install for pyodbc ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python3 -u -c 'import sys,'"'"'exec'"'"'))' install --record /tmp/pip-record-w_eqzv_4/install-record.txt --single-version-externally-managed --compile --install-headers /app/python3.7.4/include/python3.7m/pyodbc
         cwd: /tmp/pip-install-fnygoose/pyodbc_7db1b044e510447c8352fe2f54d4cbe0/
    Complete output (10 lines):
    running install
    running build
    running build_ext
    building 'pyodbc' extension
    creating build
    creating build/temp.linux-x86_64-3.7
    creating build/temp.linux-x86_64-3.7/src
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPYODBC_VERSION=4.0.30 -I/app/python3.7.4/include/python3.7m -c src/buffer.cpp -o build/temp.linux-x86_64-3.7/src/buffer.o -Wno-write-strings
    gcc: error trying to exec 'cc1plus': execvp: No such file or directory
    error: command 'gcc' Failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/python3 -u -c 'import sys,'"'"'exec'"'"'))' install --record /tmp/pip-record-w_eqzv_4/install-record.txt --single-version-externally-managed --compile --install-headers /app/python3.7.4/include/python3.7m/pyodbc Check the logs for full command output.

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)