Cannot install pymssql on windows

空扰寡人 提交于 2019-12-05 08:34:04
Jason Sperske

I just went through this small bit of hell and finally got things working, here is what I ended up doing:

First locate your Python directory (for me it was c:\Python35), then following the instructions found on the PyMSSQL documentation download the FreeTDS binaries and the precompiled OpenSSL binaries. Open SSL binaries are built in different versions of MSVC, for me I needed the MSVC 2015 32-bit binaries (because my copy of Python is the 32-bit build). FreeTDS is a little more cryptic, here the different vs20xx versions work with different generations of Python, in my case -vs2015 worked because I am using Python 3.5 which should work for you as well.

Next extract the dlls from the '/bin' directory in the OpenSSL release and the /lib directory in the FreeTDS release into a folder (in my case I used c:\Python35\FreeTDS).

Finally add this folder to your system PATH. You can now run import pymssql and not receive any errors. On windows you can also create a config file located at C:\freetds.conf which can provide some global settings to keep your python scripts clear of any connection strings.

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