In order to execute SQL from Python script, you need to add the following lines to the /etc/odbc.ini file:

[Local Virtuoso]
Driver  = /PREFIX/lib/
Address = localhost:1111

where PREFIX is replaced by the full path where Virtuoso is installed and also assuming that is used let's say port 1111 in virtuoso.ini (which is set by default).

Then you should be able to connect with:

c = pyodbc.connect('DSN=Local Virtuoso;UID=dba;PWD=dba')