How to install sqlserver in python3 in win10 environment

There are really many pits for python3 to install sqlserver in the win10 environment. It took a day to finally create the environment....

 

The first error.... As shown in the figure, cann't open include file: vcruntime, this should be a running environment without VC... Since my python version is 3.7, I need to find the corresponding VC environment, the error message It shows that the corresponding VC of Microsoft Visual Studio 14.0 is 2015. This environment can be downloaded from Microsoft's official website (different VCs corresponding to different versions of python can be found online, if they do not match, an error will be reported)

 

 

The second error.... The error prompts, cannot open include file 'sqlfront.h', and later on the Internet, it is explained in this website: http://pymssql.org/en/latest/freetds.html#windows ,

The general meaning is that pymssql is actually dependent on something called FreeTDS. I checked that it is a public open source library that links sqlserve in C language. This website provides a link to download the corresponding version, mine is freetds-v0. 95.95-win-x86_64-vs2015, there are 4 folders in it after downloading (it seems that only 2 folders are useful), copy the contents of the include file to the include folder under python, and copy the contents of the lib-nossl file to python in the libs folder.

 

The third pit.... After the above two errors are resolved, just follow the usual pip install pymssql, and the result is an error. As shown in the figure, there is another mess on the Internet.

Download the appropriate version of the pymssql module from 
https://www.lfd.uci.edu/~gohlke/pythonlibs/#pymssql 

My version corresponds to pymssql-2.1.4.dev5-cp37-cp37m-win_amd64.whl (37 of the file corresponds to python37).. But I don't understand what this file is? Installation files or drivers? Someone who knows can tell me...

 

Finally, instead of using the command pip install pymssql, replace it with pip install pymssql-2.1.4.dev5-cp37-cp37m-win_amd64.whl. After the installation is successful, it will prompt that pymssql has been installed in the package (similar to this prompt, Forgot the specifics)

 

So far....Finally complete the installation...Share with you guys....

 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325067880&siteId=291194637
Recommended