简体   繁体   English

Python(自制)在Sqlite上返回错误

[英]Python (homebrew) returns error on Sqlite

I have Python 2.7.6 and Python 3.3.4 installed through homebrew. 我通过自制软件安装了Python 2.7.6和Python 3.3.4。 I ran into some errors when trying to use Sqlite and I traced the error to a "symbol not found" error. 尝试使用Sqlite时遇到了一些错误,并且将错误跟踪为“找不到符号”错误。 Please see the trace below. 请参阅下面的跟踪。

How can I get this thing to work? 我怎样才能使这个东西正常工作?

>>> import sqlite3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sqlite3/__init__.py", line 24, in <module>
    from dbapi2 import *
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sqlite3/dbapi2.py", line 27, in <module>
    from _sqlite3 import *
ImportError: dlopen(/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_sqlite3.so, 2): Symbol not found: _sqlite3_enable_load_extension
  Referenced from: /usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_sqlite3.so
  Expected in: /usr/lib/libsqlite3.dylib
 in /usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_sqlite3.so

edit: Sqlite3 also seems to be properly installed (sqlite-3.8.3 already installed). 编辑:Sqlite3似乎也已正确安装(已经安装了sqlite-3.8.3)。

On a sidenote, why does homebrew stick with Python 2.7.6 while the Python website offers version 2.7.8 for download? 在旁注中,为什么自制软件仍然坚持使用Python 2.7.6,而Python网站却提供了2.7.8版本供下载?

You need to run brew update ; 您需要运行brew update both the sqlite formula and the python formula have seen numerous updates. sqlite公式python公式均已进行了大量更新。

Python 2.7.8 has been available since July 2nd , for example. 例如,Python 2.7.8自7月2日起可用。 Your SQLite problems have probably long been solved with updates as well. 您的SQLite问题很可能也已经通过更新解决了。

It is always a good idea to run brew doctor when you are having problems with Homebrew-supplied software; 如果您对Homebrew提供的软件有问题,请运行brew doctor总是一个好主意。 the output would have told you to run brew update too: 输出也会告诉您也运行brew update

$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!

Warning: Your Homebrew is outdated.
You haven't updated for at least 24 hours. This is a long time in brewland!
To update Homebrew, run `brew update`.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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