【发布时间】:2019-04-07 06:16:14
【问题描述】:
pyenv 在 macOS 上安装了 python 3.7.0。
sqlite3 已安装:
which sqlite3
/usr/bin/sqlite3
还尝试通过 pip 安装pysqlite3:
pip install pysqlite3
但是导入sqlite3时找不到模块:
In [1]: import sqlite3
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-5239c6be4108> in <module>
----> 1 import sqlite3
~/.pyenv/versions/3.7.0/lib/python3.7/sqlite3/__init__.py in <module>
21 # 3. This notice may not be removed or altered from any source distribution.
22
---> 23 from sqlite3.dbapi2 import *
~/.pyenv/versions/3.7.0/lib/python3.7/sqlite3/dbapi2.py in <module>
25 import collections.abc
26
---> 27 from _sqlite3 import *
28
29 paramstyle = "qmark"
ModuleNotFoundError: No module named '_sqlite3'
是否需要通过brew在macOS上安装sqlite3的开发库?
【问题讨论】:
标签: python macos sqlite pip homebrew