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/
1
panghua OP 用 Python3 版本
|
2
panghua OP 已经解决:
sudo apt install python3-pip sudo apt install unixodbc-dev sudo pip3 install pyodbc 就三步 |