简体   繁体   English

自制Python SQLite无法在macOS Sierra上构建

[英]Homebrew Python SQLite not building on macOS Sierra

I've installed Homebrew Python on my computer running macOS sierra. 我已经在运行macOS sierra的计算机上安装了Homebrew Python。 The problem is that SQLite doesn't work, at all: 问题是SQLite根本不起作用:

Python 2.7.11 (default, Jul  8 2016, 15:45:55)
[GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.24.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite3
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/Cellar/python/2.7.11/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.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/sqlite3/dbapi2.py", line 28, in <module>
    from _sqlite3 import *
ImportError: No module named _sqlite3

I reinstalled python with --verbose and found this information: 我用--verbose重新安装了python并找到了以下信息:

*** WARNING: renaming "_sqlite3" since importing it failed: dlopen(build/lib.macosx-10.12-x86_64-2.7/_sqlite3.so, 2): Symbol not found: _sqlite3_enable_load_extension
  Referenced from: build/lib.macosx-10.12-x86_64-2.7/_sqlite3.so
  Expected in: flat namespace
 in build/lib.macosx-10.12-x86_64-2.7/_sqlite3.so

Python build finished, but the necessary bits to build these modules were not found:
_bsddb             dl                 imageop
linuxaudiodev      ossaudiodev        spwd
sunaudiodev
To find the necessary bits, look in setup.py in detect_modules() for the module's name.


Failed to build these modules:
_sqlite3

What is going on? 到底是怎么回事? How can I get SQLite to work? 如何使SQLite工作?

Using the formula from this pull request solved my problem. 使用此请求请求中的公式解决了我的问题。 Thanks to @user2960428 for the link. 感谢@ user2960428提供的链接。 The PR hasn't been merged yet, so you can install it like this: PR尚未合并,因此您可以像这样安装它:

$ brew install https://github.com/mateusdelbianco/homebrew-core/raw/76a64eaf01ade6e9819a6f7b81034b1992181652/Formula/python.rb

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

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