zoukankan      html  css  js  c++  java
  • python3 安装pyodbc失败 pip3 install pyodbc

    python3 安装pyodbc失败

    报错1: 关键报错信息: fatal error: sql.h: No such file or directory 

    [root@centfos python38]# pip3 install pyodbc
    Collecting pyodbc
    Using cached https://files.pythonhosted.org/packages/81/0d/bb08bb16c97765244791c73e49de9fd4c24bb3ef00313aed82e5640dee5d/pyodbc-4.0.30.tar.gz
    Installing collected packages: pyodbc
    Running setup.py install for pyodbc ... error
    ERROR: Command errored out with exit status 1:
    command: /usr/local/python38/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-rqyoyjuj/pyodbc/setup.py'"'"'; __file__='"'"'/tmp/pip-install-rqyoyjuj/pyodbc/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'
    '"'"', '"'"'
    '"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-_cvw7biv/install-record.txt --single-version-externally-managed --compile
    cwd: /tmp/pip-install-rqyoyjuj/pyodbc/
    Complete output (14 lines):
    running install
    running build
    running build_ext
    building 'pyodbc' extension
    creating build
    creating build/temp.linux-x86_64-3.8
    creating build/temp.linux-x86_64-3.8/src
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPYODBC_VERSION=4.0.30 -I/usr/local/python38/include/python3.8 -c src/buffer.cpp -o build/temp.linux-x86_64-3.8/src/buffer.o -Wno-write-strings
    In file included from src/buffer.cpp:12:0:
    src/pyodbc.h:56:17: fatal error: sql.h: No such file or directory
    #include <sql.h>
    ^
    compilation terminated.
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
    ERROR: Command errored out with exit status 1: /usr/local/python38/bin/python3.8 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-rqyoyjuj/pyodbc/setup.py'"'"'; __file__='"'"'/tmp/pip-install-rqyoyjuj/pyodbc/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'
    '"'"', '"'"'
    '"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-_cvw7biv/install-record.txt --single-version-externally-managed --compile Check the logs for full command output.
    WARNING: You are using pip version 19.2.3, however version 20.0.2 is available.
    You should consider upgrading via the 'pip install --upgrade pip' command.
    

      

    解决方法: 

    [root@centos python38]# sudo yum install unixODBC-devel
    

     

    然后再安装pyodbc:

    [root@centos python38]# pip3 install pyodbc
    Collecting pyodbc
    Using cached https://files.pythonhosted.org/packages/81/0d/bb08bb16c97765244791c73e49de9fd4c24bb3ef00313aed82e5640dee5d/pyodbc-4.0.30.tar.gz
    Installing collected packages: pyodbc
    Running setup.py install for pyodbc ... done
    Successfully installed pyodbc-4.0.30
    WARNING: You are using pip version 19.2.3, however version 20.0.2 is available.
    You should consider upgrading via the 'pip install --upgrade pip' command.
    

      

    报错2: 关键报错信息: ModuleNotFoundError: No module named '_ctypes'

    解决方法:

      yum install libffi-devel 

    然后从config开始重新编译安装。

  • 相关阅读:
    Windows平台下MySQL常用操作与命令
    button和sumbit提交表单的区别
    AjaxPro.Net的使用
    小写金额转换成大写
    sqlserver自动定时备份数据库并按日期命名
    dw文档的当前编码不能正确保存文档所有字符.....
    windows 2003 ii6 上运行asp出现http500错误
    图片提示预览效果
    一个网站优化seo的年终工作总结
    很COOL的相册
  • 原文地址:https://www.cnblogs.com/DBArtist/p/python_pyodbc_install.html
Copyright © 2011-2022 走看看