V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
panghua
V2EX  ›  问与答

django 中安装 pyodbc,报错 warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ 该如何解决?

  •  
  •   panghua · 2018-07-02 12:29:43 +08:00 · 4387 次点击
    这是一个创建于 2362 天前的主题,其中的信息可能已经有所发展或是发生改变。

    django 中安装 pyodbc 和,报错如下: Collecting pyodbc==4.0.23 Using cached https://files.pythonhosted.org/packages/aa/71/cef225c4889620a1a00251d24c1746fe0cf4124290a75d1c2dc5c187b61f/pyodbc-4.0.23.tar.gz Building wheels for collected packages: pyodbc Running setup.py bdist_wheel for pyodbc ... error Complete output from command /home/python/venv/healthcloud/venv/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-install-r8lp4myx/pyodbc/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-cwzrptx8 --python-tag cp35: running bdist_wheel running build running build_ext building 'pyodbc' extension creating build creating build/temp.linux-x86_64-3.5 creating build/temp.linux-x86_64-3.5/src x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-0lXFsV/python3.5-3.5.4~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPYODBC_VERSION=4.0.23 -I/usr/include/python3.5m -I/home/python/venv/healthcloud/venv/include/python3.5m -c src/pyodbcmodule.cpp -o build/temp.linux-x86_64-3.5/src/pyodbcmodule.o -Wno-write-strings cc1plus: warning: command line option ‘-Wstrict-prototypes ’ is valid for C/ObjC but not for C++ In file included from src/pyodbcmodule.cpp:11:0: src/pyodbc.h:45:10: fatal error: Python.h: 没有那个文件或目录 #include <Python.h> ^~~~~~~~~~ compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1


    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 Complete output from command /home/python/venv/healthcloud/venv/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-install-r8lp4myx/pyodbc/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-record-oz_hthuf/install-record.txt --single-version-externally-managed --compile --install-headers /home/python/venv/healthcloud/venv/include/site/python3.5/pyodbc: running install running build running build_ext building 'pyodbc' extension creating build creating build/temp.linux-x86_64-3.5 creating build/temp.linux-x86_64-3.5/src x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-0lXFsV/python3.5-3.5.4~rc1=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPYODBC_VERSION=4.0.23 -I/usr/include/python3.5m -I/home/python/venv/healthcloud/venv/include/python3.5m -c src/pyodbcmodule.cpp -o build/temp.linux-x86_64-3.5/src/pyodbcmodule.o -Wno-write-strings cc1plus: warning: command line option ‘-Wstrict-prototypes ’ is valid for C/ObjC but not for C++ In file included from src/pyodbcmodule.cpp:11:0: src/pyodbc.h:45:10: fatal error: Python.h: 没有那个文件或目录 #include <Python.h> ^~~~~~~~~~ compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
    

    Command "/home/python/venv/healthcloud/venv/bin/python3 -u -c "import setuptools, tokenize;file='/tmp/pip-install-r8lp4myx/pyodbc/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-record-oz_hthuf/install-record.txt --single-version-externally-managed --compile --install-headers /home/python/venv/healthcloud/venv/include/site/python3.5/pyodbc" failed with error code 1 in /tmp/pip-install-r8lp4myx/pyodbc/

    2 条回复    2018-07-02 13:15:29 +08:00
    panghua
        1
    panghua  
    OP
       2018-07-02 12:31:03 +08:00
    用 Python3 版本
    panghua
        2
    panghua  
    OP
       2018-07-02 13:15:29 +08:00
    已经解决:
    sudo apt install python3-pip
    sudo apt install unixodbc-dev
    sudo pip3 install pyodbc
    就三步
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3490 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 53ms · UTC 04:50 · PVG 12:50 · LAX 20:50 · JFK 23:50
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.