Cannot install pymssql on windows

强颜欢笑 提交于 2019-12-07 04:48:37

问题


i am trying to install pymssql as

pip install pymssql

i have windows 7 and python 3.5 (from anaconda) but i get

Failed building wheel for pymssql

i believe its related to freetds and python-dev. how do i install these on windows?

Which packages would i need to install? this pip install worked just fine for python 2.7. If the pip does not work,is there any other way i can download and install pymssql?


回答1:


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.



来源:https://stackoverflow.com/questions/35303462/cannot-install-pymssql-on-windows

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