简体   繁体   中英

Module sqlite3 not found after using sys.path.append in python

I have the Django framework installed so sqlite3 should be implicitly installed.

When I am trying to access sqlite3 module by adjusting the PYTHONPATH in the interpreter like so:

sys.path.append('/opt/local/bin/')
import sqlite3

it gives the error:

ImportError: No module named sqlite3

sqlite3 exists in the specified path

icepdf$ ls /opt/local/bin/sqlite3
/opt/local/bin/sqlite3*

I couldn't find a sqlite3 module in any other place. I also tried to print all modules I have access to by calling:

sys.path.append('/opt/local/bin/')
print help('modules')

but sqlite does not appear. I am doing the import wrong? The sqlite3 module should be in a different place? Thanks in advance!

I am using Mac OS X Yosemite system on a Vagrant Client and installed Django1.4.5 using mac ports. I am also using Python2.7 built-in for Mac

The file in /opt/local/bin is - as the name implies - a binary file to run sqlite3 from the command line. It has nothing to do with Python.

Python includes an sqlite3 module in the standard library. You do not need to install anything or change sys.path to use it.

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