Can';找不到'_sqlite3';使用pyenv安装的python导入模块时

Can';找不到'_sqlite3';使用pyenv安装的python导入模块时,python,macos,sqlite,pip,homebrew,Python,Macos,Sqlite,Pip,Homebrew,通过macOS上的pyenv安装了python 3.7.0 sqlite3已安装: which sqlite3 /usr/bin/sqlite3 还尝试通过pip安装pysqlite3: pip install pysqlite3 但在导入sqlite3时找不到模块: In [1]: import sqlite3 --------------------------------------------------------------------------- ModuleNotFound

通过macOS上的
pyenv
安装了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'
[1]中的
:导入sqlite3
---------------------------------------------------------------------------
ModuleNotFoundError回溯(上次最近调用)
在里面
---->1导入sqlite3
中的~/.pyenv/versions/3.7.0/lib/python3.7/sqlite3/\uuu init\uuuu.py
21 # 3. 不得从任何源分发中删除或更改此通知。
22
--->23从sqlite3.dbapi2导入*
中的~/.pyenv/versions/3.7.0/lib/python3.7/sqlite3/dbapi2.py
25导入集合.abc
26
--->27从_sqlite3导入*
28
29 paramstyle=“qmark”
ModuleNotFoundError:没有名为“\u sqlite3”的模块
是否需要通过brew在macOS上安装sqlite3的开发库?

这种方式有效:

CFLAGS="-I$(xcrun --show-sdk-path)/usr/include" pyenv install 3.7.0
参考:


如果我不在mac电脑上也没有xcrun怎么办