尝试从Kali Linux中的VSCODE终端安装PYODBC,遇到错误

发布于 2025-02-10 08:29:28 字数 3496 浏览 2 评论 0原文

我正在运行Kali Linux并尝试安装PyoDBC。我正在进行PIP安装pyodbc,并获得了很长的错误列表,该错误以 我正在尝试从Kali Linux中的VSCODE终端安装PYODBC,这是错误的。 我还安装了Python3和Python2,并在系统和更新的PIP版本中设置了环境变量。

pip install pyodbc  
        
Defaulting to user installation because normal site-packages is not writeable
Collecting pyodbc
  Using cached pyodbc-4.0.32.tar.gz (280 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: pyodbc
  Building wheel for pyodbc (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [14 lines of output]
      running bdist_wheel
      running build
      running build_ext
      building 'pyodbc' extension
      creating build
      creating build/temp.linux-x86_64-3.10
      creating build/temp.linux-x86_64-3.10/src
      x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPYODBC_VERSION=4.0.32 -I/usr/include/python3.10 -c src/buffer.cpp -o build/temp.linux-x86_64-3.10/src/buffer.o -Wno-write-strings
      In file included from src/buffer.cpp:12:
      src/pyodbc.h:56:10: fatal error: sql.h: No such file or directory
         56 | #include <sql.h>
            |          ^~~~~~~
      compilation terminated.
      error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  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: subprocess-exited-with-error
  
  × Running setup.py install for pyodbc did not run successfully.
  │ exit code: 1
  ╰─> [16 lines of output]
      running install
      /usr/lib/python3/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_ext
      building 'pyodbc' extension
      creating build
      creating build/temp.linux-x86_64-3.10
      creating build/temp.linux-x86_64-3.10/src
      x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPYODBC_VERSION=4.0.32 -I/usr/include/python3.10 -c src/buffer.cpp -o build/temp.linux-x86_64-3.10/src/buffer.o -Wno-write-strings
      In file included from src/buffer.cpp:12:
      src/pyodbc.h:56:10: fatal error: sql.h: No such file or directory
         56 | #include <sql.h>
            |          ^~~~~~~
      compilation terminated.
      error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> pyodbc

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.```
                                              

I am running Kali Linux and trying to install pyodbc. I am doing pip install pyodbc and get a very long list of errors, which end in
I'm trying to install pyodbc from vscode terminal in Kali linux, it's getting error.
I have installed python3 and python2 also and also set environment variable in system and updated pip version.

pip install pyodbc  
        
Defaulting to user installation because normal site-packages is not writeable
Collecting pyodbc
  Using cached pyodbc-4.0.32.tar.gz (280 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: pyodbc
  Building wheel for pyodbc (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [14 lines of output]
      running bdist_wheel
      running build
      running build_ext
      building 'pyodbc' extension
      creating build
      creating build/temp.linux-x86_64-3.10
      creating build/temp.linux-x86_64-3.10/src
      x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPYODBC_VERSION=4.0.32 -I/usr/include/python3.10 -c src/buffer.cpp -o build/temp.linux-x86_64-3.10/src/buffer.o -Wno-write-strings
      In file included from src/buffer.cpp:12:
      src/pyodbc.h:56:10: fatal error: sql.h: No such file or directory
         56 | #include <sql.h>
            |          ^~~~~~~
      compilation terminated.
      error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  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: subprocess-exited-with-error
  
  × Running setup.py install for pyodbc did not run successfully.
  │ exit code: 1
  ╰─> [16 lines of output]
      running install
      /usr/lib/python3/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
        warnings.warn(
      running build
      running build_ext
      building 'pyodbc' extension
      creating build
      creating build/temp.linux-x86_64-3.10
      creating build/temp.linux-x86_64-3.10/src
      x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPYODBC_VERSION=4.0.32 -I/usr/include/python3.10 -c src/buffer.cpp -o build/temp.linux-x86_64-3.10/src/buffer.o -Wno-write-strings
      In file included from src/buffer.cpp:12:
      src/pyodbc.h:56:10: fatal error: sql.h: No such file or directory
         56 | #include <sql.h>
            |          ^~~~~~~
      compilation terminated.
      error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: legacy-install-failure

× Encountered error while trying to install package.
╰─> pyodbc

note: This is an issue with the package mentioned above, not pip.
hint: See above for output from the failure.```
                                              

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

指尖上的星空 2025-02-17 08:29:28

这似乎是已知的 with pyodbc。在GitHub问题中,作者说:“您没有计算机上所需的ODBC标头文件。”

对于Ubuntu,他建议sudo apt install unixoDBC-dev,我认为这也可以在Kali Linux上使用。

This seems to be a known issue with pyodbc. In the github issue, the author says "You don't have the required ODBC header files on your machine."

For Ubuntu, he suggests sudo apt install unixodbc-dev, which I think would also work on Kali Linux.

我不会写诗 2025-02-17 08:29:28

正如您所说的那样,这可能是因为您安装了多个版本的Python口译器,而PIP不知道要安装哪个Python解释器。尝试一下:

python3 -m pip install

python -m pip install

Its probably, cause you installed multiple version of python interpreters, as you said yourself, and pip is not know to which python interpreter to install to. try this:

python3 -m pip install

or

python -m pip install
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文