Update
Due to negative feedback from the user community regarding the 2.1.2 change, pymssql 2.1.3 and later have reverted to having pip install pymssql
distribute pre-compiled wheel files that are statically linked to FreeTDS without SSL support.
Therefore if you need SSL support then you still cannot simply do pip install pymssql
. For Windows you'll need to follow the procedure below, or for Linux you'll need to build pymssql (and possibly FreeTDS) from source using a procedure like the one described in the answers to this question
Version 2.1.2 of pymssql introduced a significant change in the way it needs to be set up on Windows. Previous versions were distributed with FreeTDS statically linked so all we needed to do was install pymssql (e.g., pip install pymssql
) and it "just worked", but SSL connections were not supported.
Beginning with pymssql version 2.1.2, pymssql is dynamically linked with FreeTDS on Windows and does not ship with the required components of FreeTDS (and OpenSSL, if required). We can still install pymssql itself using pip install pymssql
, but that may no longer be sufficient. If we don't already have a working installation of FreeTDS on the Windows machine then we have to download the components ourselves.
The download links can be found on the pymssql documentation page here:
pymssql - Docs - FreeTDS - Installation - Windows.
If an SSL connection is not required then we just have to download the FreeTDS components and ensure that the contents of the "lib-nossl" folder can be found by searching the Windows PATH
.
If an SSL connection is required then we have to download both the FreeTDS and OpenSSL components and ensure that the appropriate DLLs (in the "lib" folder for FreeTDS, and in the "bin" or "bin64" folder for OpenSSL) can be located by searching the Windows PATH
.
Note that these changes affect both new installs and upgrades of pymssql. It has been reported that simply upgrading pymssql from version 2.1.1 to version 2.1.2 will break pymssql on Windows until the required components of FreeTDS (and OpenSSL, if required) are downloaded.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…