[ERROR]pip insall pyodbc

- 错误代码如下:

pip install pyodbc
Looking in indexes: http://172.16.1.250/repository/douban/simple
Collecting pyodbc
  Downloading http://172.16.1.250/repository/douban/packages/31/14/124da4b15df927c8a9192c44a42523e289e5a815acd437fd5ce5c2cbc515/pyodbc-4.0.28.tar.gz (264 kB)
     |████████████████████████████████| 264 kB 38.4 MB/s
Installing collected packages: pyodbc
    Running setup.py install for pyodbc ... error
    ERROR: Command errored out with exit status 1:
     command: /root/.pyenv/versions/3.7.4/envs/flask-env-3.7.4/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-v979njx5/pyodbc/setup.py'"'"'; __file__='"'"'/tmp/pip-install-v979njx5/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-68v8gv98/install-record.txt --single-version-externally-managed --compile --install-headers /root/.pyenv/versions/3.7.4/envs/flask-env-3.7.4/include/site/python3.7/pyodbc
         cwd: /tmp/pip-install-v979njx5/pyodbc/
    Complete output (10 lines):
    running install
    running build
    running build_ext
    building 'pyodbc' extension
    creating build
    creating build/temp.linux-x86_64-3.7
    creating build/temp.linux-x86_64-3.7/src
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPYODBC_VERSION=4.0.28 -I/root/.pyenv/versions/3.7.4/envs/flask-env-3.7.4/include -I/root/.pyenv/versions/3.7.4/include/python3.7m -c src/buffer.cpp -o build/temp.linux-x86_64-3.7/src/buffer.o -Wno-write-strings
    gcc: error trying to exec 'cc1plus': execvp: No such file or directory
    error: command 'gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /root/.pyenv/versions/3.7.4/envs/flask-env-3.7.4/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-v979njx5/pyodbc/setup.py'"'"'; __file__='"'"'/tmp/pip-install-v979njx5/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-68v8gv98/install-record.txt --single-version-externally-managed --compile --install-headers /root/.pyenv/versions/3.7.4/envs/flask-env-3.7.4/include/site/python3.7/pyodbc Check the logs for full command output.
View Code

 - 安装 gcc-c-c++

yum install -y gcc-c++

- 继续报错

(flask-env-3.7.4) [root@controller flask-env-3.7.4]# pip3 install pyodbc
Looking in indexes: http://172.16.1.250/repository/douban/simple
Collecting pyodbc
  Downloading http://172.16.1.250/repository/douban/packages/31/14/124da4b15df927c8a9192c44a42523e289e5a815acd437fd5ce5c2cbc515/pyodbc-4.0.28.tar.gz (264 kB)
     |████████████████████████████████| 264 kB 52.1 MB/s
Installing collected packages: pyodbc
    Running setup.py install for pyodbc ... error
    ERROR: Command errored out with exit status 1:
     command: /root/.pyenv/versions/3.7.4/envs/flask-env-3.7.4/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ks9xm6sj/pyodbc/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ks9xm6sj/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-5nfyd0a8/install-record.txt --single-version-externally-managed --compile --install-headers /root/.pyenv/versions/3.7.4/envs/flask-env-3.7.4/include/site/python3.7/pyodbc
         cwd: /tmp/pip-install-ks9xm6sj/pyodbc/
    Complete output (14 lines):
    running install
    running build
    running build_ext
    building 'pyodbc' extension
    creating build
    creating build/temp.linux-x86_64-3.7
    creating build/temp.linux-x86_64-3.7/src
    gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -DPYODBC_VERSION=4.0.28 -I/root/.pyenv/versions/3.7.4/envs/flask-env-3.7.4/include -I/root/.pyenv/versions/3.7.4/include/python3.7m -c src/buffer.cpp -o build/temp.linux-x86_64-3.7/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: /root/.pyenv/versions/3.7.4/envs/flask-env-3.7.4/bin/python3.7 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ks9xm6sj/pyodbc/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ks9xm6sj/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-5nfyd0a8/install-record.txt --single-version-externally-managed --compile --install-headers /root/.pyenv/versions/3.7.4/envs/flask-env-3.7.4/include/site/python3.7/pyodbc Check the logs for full command output.
View Code

- 安装 unixODBC-devel

yum install -y unixODBC-devel

- 完美解决

(flask-env-3.7.4) [root@controller flask-env-3.7.4]# pip3 install pyodbc
Looking in indexes: http://172.16.1.250/repository/douban/simple
Collecting pyodbc
  Downloading http://172.16.1.250/repository/douban/packages/31/14/124da4b15df927c8a9192c44a42523e289e5a815acd437fd5ce5c2cbc515/pyodbc-4.0.28.tar.gz (264 kB)
     |████████████████████████████████| 264 kB 21.1 MB/s
Installing collected packages: pyodbc
    Running setup.py install for pyodbc ... done
Successfully installed pyodbc-4.0.28
View Code

 

posted @ 2020-02-12 11:02  LeoShi2020  阅读(286)  评论(0编辑  收藏  举报