在 Windows 上为 Python 3.7 安装 pyodbc
Installing pyodbc for Python 3.7 on Windows
我是 python 的新手,我需要连接到 SQL 服务器。我在我的 DB_Connect.py 文件中 运行 以下命令。我从 CMD 行 运行 python DB_Connect.py 并且它在 import pyodbc
上给出错误。
Pic of error
然后我 运行 命令 pip install pyodbc
但它给出了一个错误,说 "Microsoft Visual C++ 14.0 is required"。我安装了 "Microsoft Visual C++ 2015 Redistributable" 来适应这个,因为我需要获得完整版本的许可证。我的理解是这会起作用。我仍然收到此错误:
Pic of pip install pyodbc err
我需要安装完整版的 Visual C++ 还是有免费选项?为什么这个 CMD 不能与 Redistributable 版本一起使用?我如何通过这一步?
PC:windows 7 亲 - 64
Python版本:3.7.0
更新2018-08-15
pyodbc 4.0.24,今天发布,现在包括 Python 3.7 轮子,用于通过 pip
.
安装在 Windows 和 Mac 上
(原答案)
Python 3.7 的 pyodbc wheel 文件在 PyPI. They have been requested via the GitHub issue here.
上尚不可用
您可以暂时恢复到 Python 3.6。或者,如果您现在确实需要 Python 3.7 ,那么您必须安装所需的 Visual Studio 组件,以便pip
可以从源代码构建 pyodbc。详情 here.
I then I ran command pip install pyodbc but it give an error saying, "Microsoft Visual C++ 14.0 is required". I installed "Microsoft Visual C++ 2015 Redistributable" to accommodate this
这不起作用,因为您安装了 Visual C++ 的运行时支持。您需要 Visual C++ 的构建工具,如 here.
所述
这个解决方案对我有用:
pip install --only-binary :all: pyodbc
更多关于以上内容:
Microsoft Visual C++ 14.0 is required (Unable to find vcvarsall.bat)
我是 python 的新手,我需要连接到 SQL 服务器。我在我的 DB_Connect.py 文件中 运行 以下命令。我从 CMD 行 运行 python DB_Connect.py 并且它在 import pyodbc
上给出错误。
Pic of error
然后我 运行 命令 pip install pyodbc
但它给出了一个错误,说 "Microsoft Visual C++ 14.0 is required"。我安装了 "Microsoft Visual C++ 2015 Redistributable" 来适应这个,因为我需要获得完整版本的许可证。我的理解是这会起作用。我仍然收到此错误:
Pic of pip install pyodbc err
我需要安装完整版的 Visual C++ 还是有免费选项?为什么这个 CMD 不能与 Redistributable 版本一起使用?我如何通过这一步?
PC:windows 7 亲 - 64 Python版本:3.7.0
更新2018-08-15
pyodbc 4.0.24,今天发布,现在包括 Python 3.7 轮子,用于通过 pip
.
(原答案)
Python 3.7 的 pyodbc wheel 文件在 PyPI. They have been requested via the GitHub issue here.
上尚不可用您可以暂时恢复到 Python 3.6。或者,如果您现在确实需要 Python 3.7 ,那么您必须安装所需的 Visual Studio 组件,以便pip
可以从源代码构建 pyodbc。详情 here.
I then I ran command pip install pyodbc but it give an error saying, "Microsoft Visual C++ 14.0 is required". I installed "Microsoft Visual C++ 2015 Redistributable" to accommodate this
这不起作用,因为您安装了 Visual C++ 的运行时支持。您需要 Visual C++ 的构建工具,如 here.
所述这个解决方案对我有用:
pip install --only-binary :all: pyodbc
更多关于以上内容: Microsoft Visual C++ 14.0 is required (Unable to find vcvarsall.bat)