如何安装pyodbc 64位? [英] How to install pyodbc 64-bit?

查看:73
本文介绍了如何安装pyodbc 64位?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在运行Windows 7、64位...的计算机上都安装了Python 2.7,MySQL 5.5,MySQL ODBC Connector 5.1和pyodbc.

I have Python 2.7, MySQL 5.5, MySQL ODBC Connector 5.1, and pyodbc all installed on my computer, which is running Windows 7, 64-bit...

唯一的问题是,除了32位的pyodbc以外,所有内容都以64位安装.

Only problem is that everything is installed as 64-bit except pyodbc, which is 32-bit.

使用easy_install下载pyodbc时,它将自动下载32位版本. 因此,当我尝试使用以下方法连接到数据库时:

When using easy_install to download pyodbc, it automatically downloads the 32-bit version. Thus, when I try to connect to my database using:

cnxn = pyodbc.connect('DRIVER={MySQL ODBC 5.1 DRIVER};SERVER=localhost;DATABASE=test;UID=root;PWD=password')

我得到了错误:

Data source name not found and no default driver specified (0) (SQLDriverConnect)

当我尝试通过以下方式指定DSN时:

And when I try to specify a DSN with:

cnxn = pyodbc.connect('DSN=dsn_name;etc...')

我得到了错误:

The specified DSN contains an architecture mismatch between the Driver and Application (0) (SQLDriverConnect)

此链接告诉我,这是由于32/64位不匹配,如预期的那样: http://msdn.microsoft. com/en-us/library/windows/desktop/ms712362(v = vs.85).aspx

This link tells me that this is due to the 32/64-bit mismatch, as expected: http://msdn.microsoft.com/en-us/library/windows/desktop/ms712362(v=vs.85).aspx

所以我有两个问题:

1)是否可以强制easy_install下载64位的pyodbc,还是可以手动下载64位的pyodbc?

1) Is it possible to force easy_install to download the 64-bit pyodbc, or is it possible to download the 64-bit pyodbc manually?

2)如果以上操作均不可行,则可以使用Microsoft ODBC数据源管理器窗口将DSN配置为允许此操作.

2) If the above is not possible, is it possible to configure the DSN to allow for this using the Microsoft ODBC Data Source Administrator window.

谢谢.

推荐答案

有非官方" Python模块列表此处

There is a list of "unofficial" Python modules here

PyODBC是已编译为64位的版本之一.

PyODBC is one of those that have been compiled for 64bits.

此外,请确保您使用的是正确版本的ODBC管理器.默认将用于64位驱动程序,但是您可以将32位驱动程序与%windir%\SysWOW64\odbcad32.exe

Also, make sure you're using the correct version of the ODBC Administrator. The default will be for 64bit drivers, but you can use 32bit drivers with %windir%\SysWOW64\odbcad32.exe

这篇关于如何安装pyodbc 64位?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆