2
   File "/home/myweb/app/db.py", line 40, in __init__

    engine = create_engine('sqlite:///'+db_path)

   File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/__init__.py", line 386, in create_engine

    return strategy.create(*args, **kwargs)
   File "/usr/local/lib/python2.7/site-packages/sqlalchemy/engine/strategies.py", line 75, in create

    dbapi = dialect_cls.dbapi(**dbapi_args)
   File "/usr/local/lib/python2.7/site-  packages/sqlalchemy/dialects/sqlite/pysqlite.py", line 339, in dbapi

     raise e
  ImportError: /usr/local/lib/python2.7/site-packages/pysqlite2/_sqlite.so:

 undefined symbol: PyOS_mystrnicmp
thanks everyone, I got it. after I recompile python2.7 with sqlite3-devel, then I success.
 I guess that the first compile of python2.7 there is no  sqlite3-devel, so sqlalchemy loads pysqlite2.
thinkdeeper
  • 351
  • 1
  • 3
  • 9
  • Why are you using `pysqlite2` when there's `sqlite3` built into Python 2.7? – univerio Feb 29 '16 at 05:57
  • I did not want to install pysqlite2. after I command "pip install pysqlite", the version of pysqlite was pysqlite2. – thinkdeeper Mar 01 '16 at 06:45
  • No, there's no need to install `pysqlite2` at all because `sqlite3` is built into Python 2.7. It's part of the standard library. – univerio Mar 01 '16 at 08:04
  • First, Thank you a lot. But, after I commond "pip uninstall pysqlite", it occurs the same error, [undefined symbol: PyOS_mystrnicmp] – thinkdeeper Mar 01 '16 at 08:32
  • One valid reason not to use the built-in `sqlite3` is if you need a newer version of SQLite, no? I have a standalone sqlite3 install running 3.14.x, but my version of Python seems to report 3.7... And I'm working on a large codebase so upgrading Python to the latest 2.7.x might cause breaking changes. – Pieter Oct 10 '16 at 12:07

0 Answers0