Question

Is there any way to check if pyodbc is already installed in my MacOS (10.9)? I already had python 2.7 installed on my mac and in addition I installed python3 later. Now both version of the python works fine from my terminal.

I heard pyodbc will not work alone and it needs a odbc manager (and the recommended is iodbc for mac), is there any way for that to check as well? Me kind of new to these things and so do not intend to create mess by installing another pyodbc or iodbc which is already there on my mac.

Not sure if this info is relevant, but i want to create a database connection using ODBC that has to work both for MySQL and Postgres (I have them both installed on my mac), select some info from a table and close the connection. And right now I am on my first phase of creating a connection..

Helps will be highly appreciated.

Was it helpful?

Solution

Generally a good way to see if a python lib is installed is to go the the python prompt and attempt to import it

>>import pyodbc

Obviously, you could use find, locate, etc, but this will tell you if it is installed and working properly.

You asked about pyodbc, and generally you shouldn't give answers based on opinions on SO, but I have worked a fair bit with psycopg2 for Postgres and found it easier to use and more reliable than pyodbc. I haven't used Python with MySQL, but there are good reports for MySQLdb

I mention this because you say you are at early stages, so it might be worth considering the native drivers for each DB.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top