2016-07-12 51 views
0

我已經在運行macOS sierra的計算機上安裝了自制Python。問題是,SQLite不工作,在所有:Homebrew Python SQLite不是建立在macOS上Sierra

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 

我重新安裝了蟒蛇與--verbose,發現這樣的信息:

*** 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 

這是怎麼回事?我怎樣才能讓SQLite工作?

+2

這有幫助嗎? https://github.com/Homebrew/homebrew-core/pull/3134我自己有問題。 – user2960428

回答

1

使用this pull request的公式解決了我的問題。感謝@ user2960428的鏈接。公關尚未合併,所以你可以這樣安裝:

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

我在[pull request comments](https://github.com/Homebrew/homebrew-core/pull/3134)中關注了XxUnkn0wnxX的進程來做一個乾淨的安裝,它對我來說都是完美的! – Philoozushi