简体   繁体   中英

Unable to run code through python file or jupyter (ipython notebook), working successfully through terminal python

I have this python code:

#!/usr/bin/env python
import pyodbc
from pandas import *
conn = pyodbc.connect("DSN=drill64", autocommit=True)
cursor = conn.cursor()

which on running as a .py file aur running through ipython notebook gives me the below error

Traceback (most recent call last):
  File "/home/ubuntu/TestingDrillQuery.py", line 14, in <module>
    conn = pyodbc.connect("DSN=drill64", autocommit=True)
pyodbc.Error: ('01000', "[01000] [unixODBC][Driver Manager]Can't open lib '/opt/mapr/drillodbc/lib/64/libmaprdrillodbc64.so' : file not found (0) (SQLDriverConnect)")
[Finished in 0.4s with exit code 1]

On running through terminal python everything works smoothly, any suggestions appreciated.

好的,我可以通过chmod +x TestingDrillQuery.py .py文件的权限更改为chmod +x TestingDrillQuery.py来解决此chmod +x TestingDrillQuery.py

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM