如何在 Windows 7 上为 Python 3.5 或 3.3 安装 pyodbc

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/46435471/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 17:39:01  来源:igfitidea点击:

How to install pyodbc for Python 3.5 or 3.3 on windows 7

pythonpython-3.5pyodbcpython-3.3

提问by Amir. A

I need to install pyodbc to use with python 3.5 or python 3.3 on Windows 7. when I use pip I get the error saying: "could not find a version that satisfies the requirement pyodbc (from versions:) No matching distribution found for pyodbc"

我需要安装 pyodbc 以在 Windows 7 上与 python 3.5 或 python 3.3 一起使用。当我使用 pip 时,我收到错误消息:“找不到满足 pyodbc 要求的版本(来自版本:)没有找到与 pyodbc 匹配的发行版”

When I check https://pypi.python.org/pypi/pyodbc/I don't see corresponding version. Could someone confirm that there is no pyodbc for 3.5 or 3.3? if that's the case, how can I get connected to MS SQL Server?

当我检查https://pypi.python.org/pypi/pyodbc/ 时,我没有看到相应的版本。有人可以确认3.5或3.3没有pyodbc吗?如果是这样,我如何才能连接到 MS SQL Server?

回答by Simon

Steps that worked for me:

对我有用的步骤:

  1. pyodbc listhere is a list of whl files. Download the right one for you.
  2. Open cmd as administrator and go to the directory containing the file.
  3. Run pip install pyodbc-xxxxx.whl.
  1. 这里的pyodbc list是 whl 文件的列表。下载适合您的一款。
  2. 以管理员身份打开 cmd 并转到包含该文件的目录。
  3. 运行pip install pyodbc-xxxxx.whl

回答by Bindu Madhavi T

Try installing using

尝试安装使用

pip install pyodbc

in cmd as administrator.

在 cmd 中作为管理员。

If you are unable to install or getting cl.exe error, then you could change import pyodbcto import pypyodbcin your script. That module is similar to pyodbc but is purely python, so it is easy to install:

如果您无法安装或出现 cl.exe 错误,那么您可以在脚本中更改import pyodbcimport pypyodbc。该模块类似于pyodbc,但纯粹是python,因此很容易安装:

pip install pypyodbc