| title | Step 1: Configure pymssql environment |
|---|---|
| description | Step 1 of this getting started guide involves installing Python, the Microsoft ODBC Driver for SQL Server, and pymssql into your development environment. |
| author | David-Engel |
| ms.author | v-davidengel |
| ms.date | 01/19/2017 |
| ms.prod | sql |
| ms.technology | connectivity |
| ms.topic | conceptual |
You will need to configure your development environment with the prerequisites in order to develop an application using the Python Driver for SQL Server.
The Python SQL Drivers use the TDS protocol, which is enabled by default in SQL Server and Azure SQL Database. No additional configuration is required.
-
Install Python runtime and pip package manager.
a. Go to python.org
b. Click on the appropriate Windows installer msi link.
c. Once downloaded run the msi to install Python runtime -
Download pymssql module from here
Make sure you choose the correct
whlfile. For example: If you are using Python 2.7 on a 64-bit machine choosepymssql‑2.1.1‑cp27‑none‑win_amd64.whl. Once you download thewhlfile, place it in the C:\Python27 folder. -
Open cmd.exe
-
Install pymssql module.
For example, if you are using Python 2.7 on a 64-bit machine:
> cd c:\Python27
> pip install pymssql‑2.1.1‑cp27‑none‑win_amd64.whl
- Install Python runtime and pip package manager. Python comes pre-installed on most distributions of Ubuntu. If your machine does not have python installed, you can either download the source tarball from python.org and build locally, or you can use the package manager:
> sudo apt-get install python
-
Open terminal
-
Install pymssql module and dependencies
> sudo apt-get --assume-yes update
> sudo apt-get --assume-yes install freetds-dev freetds-bin
> sudo apt-get --assume-yes install python-dev python-pip
> sudo pip install pymssql
-
Install Python runtime and pip package manager
a. Go to python.org
b. Click on the appropriate macOS installer pkg link.
c. Once downloaded run the pkg to install Python runtime -
Open terminal
-
Install Homebrew package manager
> ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
- Install FreeTDS module
> brew install FreeTDS
- Install pymssql module
> sudo -H pip install pymssql