D
D
DVoropaev2017-10-05 11:09:28
linux
DVoropaev, 2017-10-05 11:09:28

Why is pyodbc not working?

Installed like this:

638  sudo apt-get install unixodbc unixodbc-dev freetds-dev tdsodbc python-dev
  639  zsudo easy_install pyodbc
  640  sudo easy_install pyodbc
 ...
  649  sudo apt-get install python-pip
  650  sudo apt-get install unixodbc-dev
  651  pip install pyodbc

main.py file:
import pyodbc
cnxn = pyodbc.connect('DRIVER={SQL Server};SERVER=127.0.0.1;DATABASE=Voropaev;UID=SA;PWD=.gbnth143')
cursor = cnxn.cursor()

Tried launching it in two ways:
python ./main.py
Traceback (most recent call last):
  File "./main.py", line 2, in <module>
    cnxn = pyodbc.connect('DRIVER={SQL Server};SERVER=127.0.0.1;DATABASE=Voropaev;UID=SA;PWD=.gbnth143')
pyodbc.Error: ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib 'SQL Server' : file not found (0) (SQLDriverConnect)")

python3 ./main.py 
Traceback (most recent call last):
  File "./main.py", line 1, in <module>
    import pyodbc
ImportError: No module named 'pyodbc'

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Ranc58, 2017-10-05
@Ranc58

pip3 install instead of pip install try

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question