Tuesday, June 5, 2018

How do you install pyodbc?

pyodbc is an open source Python module that simplifies accessing ODBC databases. It implements the DB API 2.0 specs and has been filled with Python related items.

It can be installed with pip, with this simple statement:

pip install pyodbc

The following link provides the steps to install and configure pyodbc on Windows. The versions I have used are not the same ones used in the above link as I faced difficulties following the items.

I used Python 3.7 which was described in my previous post:
https://hodentekmsss.blogspot.com/2018/03/you-need-python-to-install-command-line.html

I followed this with installing Microsoft ODBC Driver from here:
https://docs.microsoft.com/en-us/sql/connect/sql-connection-libraries?view=sql-server-2017#anchor-20-drivers-relational-access

You must download the ODBC for working with Python in the above page.

Python drivers.png

Download the ones you want, herein the (x64)


MSODBC17.png

Double clicking the downloaded msi you can install Microsoft ODBC driver as shown here:


MSODBC17_1


Make sure you highlight the ODBC Driver for SQL Server before you click Next> on the screen.
I
t is successfully installed and gets enterer into the Drives' list in ODBC Data Source Administrator (x64) as shown.


MSODBC17_2


Now you install pyodbc using pip. I found the pip used for this post here in the Scripts folder:

C:\Users\Owner\AppData\Local\Programs\Python\Python37\Scripts

Open up a command screen in Windows and used the command as shown here:


installpyodbc.png

pyodbc gets installed here:

C:\Users\Owner\AppData\Local\Programs\Python\Python35\Lib\site-packages\









No comments: