django 中安装 pyodbc,报错 warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ 该如何解决? - V2EX
V2EX = way to explore
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 4780 次点击
    这是一个创建于 2711 天前的主题,其中的信息可能已经有所发展或是发生改变。

    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     Solana     5225 人在线   最高记录 6679       Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 390ms UTC 01:20 PVG 09:20 LAX 17:20 JFK 20:20
    Do have faith in what you're doing.
    ubao msn snddm index pchome yahoo rakuten mypaper meadowduck bidyahoo youbao zxmzxm asda bnvcg cvbfg dfscv mmhjk xxddc yybgb zznbn ccubao uaitu acv GXCV ET GDG YH FG BCVB FJFH CBRE CBC GDG ET54 WRWR RWER WREW WRWER RWER SDG EW SF DSFSF fbbs ubao fhd dfg ewr dg df ewwr ewwr et ruyut utut dfg fgd gdfgt etg dfgt dfgd ert4 gd fgg wr 235 wer3 we vsdf sdf gdf ert xcv sdf rwer hfd dfg cvb rwf afb dfh jgh bmn lgh rty gfds cxv xcv xcs vdas fdf fgd cv sdf tert sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf sdf shasha9178 shasha9178 shasha9178 shasha9178 shasha9178 liflif2 liflif2 liflif2 liflif2 liflif2 liblib3 liblib3 liblib3 liblib3 liblib3 zhazha444 zhazha444 zhazha444 zhazha444 zhazha444 dende5 dende denden denden2 denden21 fenfen9 fenf619 fen619 fenfe9 fe619 sdf sdf sdf sdf sdf zhazh90 zhazh0 zhaa50 zha90 zh590 zho zhoz zhozh zhozho zhozho2 lislis lls95 lili95 lils5 liss9 sdf0ty987 sdft876 sdft9876 sdf09876 sd0t9876 sdf0ty98 sdf0976 sdf0ty986 sdf0ty96 sdf0t76 sdf0876 df0ty98 sf0t876 sd0ty76 sdy76 sdf76 sdf0t76 sdf0ty9 sdf0ty98 sdf0ty987 sdf0ty98 sdf6676 sdf876 sd876 sd876 sdf6 sdf6 sdf9876 sdf0t sdf06 sdf0ty9776 sdf0ty9776 sdf0ty76 sdf8876 sdf0t sd6 sdf06 s688876 sd688 sdf86