简体   繁体   English

在 Pycharm 中安装 pymssql 2.1.3

[英]Install pymssql 2.1.3 in Pycharm

I'm working with Pycharm in a project to read SQL DBs ,I'm working in a windows 10 64bits workstation and I'm trying to install the module pymssql, I have already installed VS2015 to get all requirements but now each time that i try to install i got the message:我正在一个项目中使用 Pycharm 来读取 SQL DB,我正在 Windows 10 64 位工作站中工作,我正在尝试安装模块 pymssql,我已经安装了 VS2015 来满足所有要求,但现在每次我尝试安装我收到消息:

error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe' failed with exit status 2错误:命令“C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\cl.exe”失败,退出状态为 2

I saw on message details the error in: _mssql.c(266): fatal error C1083: Cannot open include file: 'sqlfront.h': No such file or directory我在消息中看到了错误的详细信息:_mssql.c(266): 致命错误 C1083: 无法打开包含文件: 'sqlfront.h': 没有这样的文件或目录

How can i figured it out?我怎么能弄明白? thanks谢谢

For anyone that is seeing this in 2021, pymssql only supports python 3.7 according to their own build files.对于在 2021 年看到这一点的任何人,pymssql 根据他们自己的构建文件仅支持 python 3.7。 Don't bother trying to use it if you are on 3.8 or higher.如果您使用的是 3.8 或更高版本,请不要费心尝试使用它。 I'm on 3.9.1我在 3.9.1

Use pyodbc instead.请改用 pyodbc。 This install worked right out of the box using windows server 2016 after spending about 3 hours of digging.在花费大约 3 个小时的挖掘时间后,此安装使用 Windows Server 2016 开箱即用。

pip install pyodbc

hope that saves you a ton of grief...希望可以为您节省大量的悲伤......

Seems that your error is a known problem, check here .似乎您的错误是一个已知问题,请在此处查看
As you can see from the last post from the link, they don't have wheels built for Python3.6, so when you try to install pymssql , the error is raised.正如您从链接的最后一篇文章中看到的那样,他们没有为 Python3.6 构建轮子,因此当您尝试安装pymssql ,会引发错误。
Still, as the post found suggests, you can try the following options:尽管如此,正如发现的帖子所暗示的那样,您可以尝试以下选项:

  1. Drop back to Python 3.5回到 Python 3.5
  2. Use the Python 3.6 wheels available here :使用此处提供的 Python 3.6 轮子:
  3. Try to build pymssql using the advice given in the forum link above.尝试使用上面论坛链接中给出的建议构建 pymssql。

If you were trying to install pymssql directly from PyCharm, I think that you should follow the options showed above but from command line如果您尝试直接从 PyCharm 安装pymssql ,我认为您应该遵循上面显示的选项,但从命令行

I had the same problem and I fixed this way.我有同样的问题,我是这样解决的。

  1. Download pymssql module from https://www.lfd.uci.edu/~gohlke/pythonlibs/#pymssql .https://www.lfd.uci.edu/~gohlke/pythonlibs/#pymssql下载 pymssql 模块。 place the .whl file in the C:\\Python38-32 folder.将 .whl 文件放在C:\\Python38-32文件夹中。

  2. Open cmd.exe打开cmd.exe

  3. Run运行

    cd C:\\Python38-32 cd C:\\Python38-32
    pip install pymssql-2.1.4-cp38-cp38-win32.whl pip 安装 pymssql-2.1.4-cp38-cp38-win32.whl

I had a same problem but its fixed this way.我有同样的问题,但它以这种方式修复。

Copied "rc.exe" and "rcdll.dll" from "C:\\Program Files (x86)\\Windows Kits\\8.1\\bin\\x86" Pasted "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\bin""C:\\Program Files (x86)\\Windows Kits\\8.1\\bin\\x86"复制"rc.exe""rcdll.dll"粘贴到"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\bin"

In my case helped me rollback to Python 3.8.就我而言,它帮助我回滚到 Python 3.8。 Same problem I had on 3.10 x64我在 3.10 x64 上遇到的同样问题

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM