pyodbc and python 3.4 on Windows

柔情痞子 提交于 2019-12-02 22:33:25
John Y

The different versions of Python are (for the most part) not binary-compatible, and thus any compiled extensions (such as pyodbc) will only work for a specific version.

Note that pure-Python packages (the ones that are completely written in Python, and have no non-Python dependencies) do not need to be compiled, and thus can be written to support multiple Python versions.

Also note that it is technically possible for a compiled extension to be written such that it works for Python 3.2 as well as 3.3, 3.4, and the future 3.x's to come, but they have to limit themselves to the "stable ABI" as specified by PEP 384, and most extensions do not do this. As far as I know, pyodbc is not limited to the stable ABI and must be compiled separately for each Python version.

That said, it is also possible to compile your own version of pyodbc from source, as long as you have the required tools and expertise. (But I'm guessing if you're asking this question, you don't. I don't either, otherwise I'd include some tips in this answer.)

As you have already commented, pypyodbc may be your best bet, as it is a pure-Python package.

Installing pypyodbc can be done via the commandline:

C:\Python34\Scripts>pip install pypyodbc

Using it as drop-in replacement of pyodbc can be done using:

import pypyodbc as pyodbc

[The current version of pyodbc at the time of this edit is 3.0.10, and it does support Python 3.4. Of course, it's still useful to be aware of pypyodbc in case pyodbc falls behind again when future versions of Python are released.]

Did you try to download from here? It has an unofficial build for 3.4. I did a quick test myself, looks like it's working fine for me.

I fixed this by installing pyodbc 3.0.10. The latest version of pyodbc didn't work on Windows with Python 3.4

However pyodbc 3.0.10 did work for me

Install command on command prompt : pip install pyodbc 3.0.10

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!