V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
panghua
V2EX  ›  问与答

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

  •  
  •   panghua · Jul 2, 2018 · 5065 views
    This topic created in 2866 days ago, the information mentioned may be changed or developed.

    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 replies    2018-07-02 13:15:29 +08:00
    panghua
        1
    panghua  
    OP
       Jul 2, 2018
    用 Python3 版本
    panghua
        2
    panghua  
    OP
       Jul 2, 2018
    已经解决:
    sudo apt install python3-pip
    sudo apt install unixodbc-dev
    sudo pip3 install pyodbc
    就三步
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1150 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 38ms · UTC 23:19 · PVG 07:19 · LAX 16:19 · JFK 19:19
    ♥ Do have faith in what you're doing.