Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/300.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 在cygwin上安装pyodbc_Python_Pip_Cygwin_Pyodbc - Fatal编程技术网

Python 在cygwin上安装pyodbc

Python 在cygwin上安装pyodbc,python,pip,cygwin,pyodbc,Python,Pip,Cygwin,Pyodbc,我在Windows 10下运行Cygwin,并且在尝试安装pyodbc时 我已经找了好几个小时类似的问题,但找不到任何对我有帮助的。据我所知,存在一些相互矛盾的数据类型声明,但我不知道该怎么办。 任何帮助都将不胜感激。感谢所有花时间帮助我的人 $ pip install pyodbc Collecting pyodbc Using cached pyodbc-4.0.14.tar.gz Building wheels for collected packages: pyodbc Runn

我在Windows 10下运行Cygwin,并且在尝试安装pyodbc时
我已经找了好几个小时类似的问题,但找不到任何对我有帮助的。据我所知,存在一些相互矛盾的数据类型声明,但我不知道该怎么办。
任何帮助都将不胜感激。感谢所有花时间帮助我的人

$ pip install pyodbc
Collecting pyodbc
  Using cached pyodbc-4.0.14.tar.gz
Building wheels for collected packages: pyodbc
  Running setup.py bdist_wheel for pyodbc ... error
  Complete output from command /home/username/projects/my_project/env/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-_m01a2yq/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/tmp90cam83npip-wheel- --python-tag cp34:
  running bdist_wheel
  running build
  running build_ext
  building 'pyodbc' extension
  creating build
  creating build/temp.cygwin-2.7.0-x86_64-3.4
  creating build/temp.cygwin-2.7.0-x86_64-3.4/src
  gcc -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -ggdb -O2 -pipe -Wimplicit-function-declaration -fdebug-prefix-map=/usr/src/ports/python3/python3-3.4.5-1.x86_64/build=/usr/src/debug/python3-3.4.5-1 -fdebug-prefix-map=/usr/src/ports/python3/python3-3.4.5-1.x86_64/src/Python-3.4.5=/usr/src/debug/python3-3.4.5-1 -DPYODBC_VERSION=4.0.14 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include -I/usr/include/python3.4m -c src/buffer.cpp -o build/temp.cygwin-2.7.0-x86_64-3.4/src/buffer.o
  cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
  cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++
  In file included from src/buffer.cpp:12:0:
  src/pyodbc.h:90:0: warning: "CDECL" redefined
   #define CDECL cdecl
   ^
  In file included from /usr/include/w32api/windef.h:8:0,
                   from /usr/include/w32api/windows.h:69,
                   from src/pyodbc.h:53,
                   from src/buffer.cpp:12:
  /usr/include/w32api/minwindef.h:83:0: note: this is the location of the previous definition
   #define CDECL
   ^
  In file included from /usr/local/include/sql.h:19:0,
                   from src/pyodbc.h:56,
                   from src/buffer.cpp:12:
  /usr/local/include/sqltypes.h:105:26: error: conflicting declaration ‘typedef short unsigned int WCHAR’
   typedef unsigned short   WCHAR;
                            ^
  In file included from /usr/include/w32api/minwindef.h:163:0,
                   from /usr/include/w32api/windef.h:8,
                   from /usr/include/w32api/windows.h:69,
                   from src/pyodbc.h:53,
                   from src/buffer.cpp:12:
  /usr/include/w32api/winnt.h:288:19: note: previous declaration as ‘typedef wchar_t WCHAR’
     typedef wchar_t WCHAR;
                     ^
  In file included from /usr/local/include/sql.h:19:0,
                   from src/pyodbc.h:56,
                   from src/buffer.cpp:12:
  /usr/local/include/sqltypes.h:261:33: error: conflicting declaration ‘typedef long unsigned int ULONG’
   typedef unsigned long           ULONG;
                                   ^
  In file included from /usr/include/w32api/combaseapi.h:153:0,
                   from /usr/include/w32api/objbase.h:14,
                   from /usr/include/w32api/ole2.h:17,
                   from /usr/include/w32api/wtypes.h:12,
                   from /usr/include/w32api/winscard.h:10,
                   from /usr/include/w32api/windows.h:97,
                   from src/pyodbc.h:53,
                   from src/buffer.cpp:12:
  /usr/include/w32api/wtypesbase.h:92:15: note: previous declaration as ‘typedef unsigned int ULONG’
   typedef DWORD ULONG;
                 ^
  error: command '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/username/projects/my_project/env/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-_m01a2yq/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-2f4vknxq-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/username/projects/my_project/env/include/site/python3.4/pyodbc:
    running install
    running build
    running build_ext
    building 'pyodbc' extension
    creating build
    creating build/temp.cygwin-2.7.0-x86_64-3.4
    creating build/temp.cygwin-2.7.0-x86_64-3.4/src
    gcc -Wno-unused-result -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -ggdb -O2 -pipe -Wimplicit-function-declaration -fdebug-prefix-map=/usr/src/ports/python3/python3-3.4.5-1.x86_64/build=/usr/src/debug/python3-3.4.5-1 -fdebug-prefix-map=/usr/src/ports/python3/python3-3.4.5-1.x86_64/src/Python-3.4.5=/usr/src/debug/python3-3.4.5-1 -DPYODBC_VERSION=4.0.14 -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/usr/include -I/usr/include/python3.4m -c src/buffer.cpp -o build/temp.cygwin-2.7.0-x86_64-3.4/src/buffer.o
    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
    cc1plus: warning: command line option ‘-Wimplicit-function-declaration’ is valid for C/ObjC but not for C++
    In file included from src/buffer.cpp:12:0:
    src/pyodbc.h:90:0: warning: "CDECL" redefined
     #define CDECL cdecl
     ^
    In file included from /usr/include/w32api/windef.h:8:0,
                     from /usr/include/w32api/windows.h:69,
                     from src/pyodbc.h:53,
                     from src/buffer.cpp:12:
    /usr/include/w32api/minwindef.h:83:0: note: this is the location of the previous definition
     #define CDECL
     ^
    In file included from /usr/local/include/sql.h:19:0,
                     from src/pyodbc.h:56,
                     from src/buffer.cpp:12:
    /usr/local/include/sqltypes.h:105:26: error: conflicting declaration ‘typedef short unsigned int WCHAR’
     typedef unsigned short   WCHAR;
                              ^
    In file included from /usr/include/w32api/minwindef.h:163:0,
                     from /usr/include/w32api/windef.h:8,
                     from /usr/include/w32api/windows.h:69,
                     from src/pyodbc.h:53,
                     from src/buffer.cpp:12:
    /usr/include/w32api/winnt.h:288:19: note: previous declaration as ‘typedef wchar_t WCHAR’
       typedef wchar_t WCHAR;
                       ^
    In file included from /usr/local/include/sql.h:19:0,
                     from src/pyodbc.h:56,
                     from src/buffer.cpp:12:
    /usr/local/include/sqltypes.h:261:33: error: conflicting declaration ‘typedef long unsigned int ULONG’
     typedef unsigned long           ULONG;
                                     ^
    In file included from /usr/include/w32api/combaseapi.h:153:0,
                     from /usr/include/w32api/objbase.h:14,
                     from /usr/include/w32api/ole2.h:17,
                     from /usr/include/w32api/wtypes.h:12,
                     from /usr/include/w32api/winscard.h:10,
                     from /usr/include/w32api/windows.h:97,
                     from src/pyodbc.h:53,
                     from src/buffer.cpp:12:
    /usr/include/w32api/wtypesbase.h:92:15: note: previous declaration as ‘typedef unsigned int ULONG’
     typedef DWORD ULONG;
                   ^
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
Command "/home/username/projects/my_project/env/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-_m01a2yq/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-2f4vknxq-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/username/projects/my_project/env/include/site/python3.4/pyodbc" failed with error code 1 in /tmp/pip-build-_m01a2yq/pyodbc/

当你安装Cygwin时,你是否安装了g++编译器?@Brian我不确定我是与Cygwin一起安装的,还是更高版本与apt cyg一起安装的,但现在肯定已经安装了。pyodbc的setup.py很可能配置为安装到windows版本的python或linux版本的python,而不是Cygwin版本的python。这意味着您可能必须在cygwin的编译指令中添加一个案例,该案例是两个其他系统的合并。你需要问如何编译一个C++的SRC,它包含CygWin上的Windows头。当你安装CygWin时,你安装了G+编译器吗?@布瑞恩,我不确定我是否安装了CygWin,或者后来用APT CYG安装了它。但是现在肯定已经安装了pyodbc的setup.py很可能被配置为安装到windows版本的python或linux版本的python,而不是cygwin版本的python。这意味着您可能必须在cygwin的编译指令中添加一个案例,该案例是两个其他系统的合并。您需要询问如何编译CygWin上包含Windows头的C++ SRC。