近日,才发现python3.6版本居然不支持sqlite3.
这个问题的引起是想实现一下tensorflow下的文本摘要模型的测试。
遇到的问题如下:
Traceback (most recent call last): File "/home/ndscbigdata/work/python/jdataApp/src/tf/textsum/textsum_data_convert.py", line 14, in <module> from nltk.tokenize import sent_tokenize File "/usr/local/lib/python3.6/site-packages/nltk/__init__.py", line 137, in <module> from nltk.stem import * File "/usr/local/lib/python3.6/site-packages/nltk/stem/__init__.py", line 29, in <module> from nltk.stem.snowball import SnowballStemmer File "/usr/local/lib/python3.6/site-packages/nltk/stem/snowball.py", line 24, in <module> from nltk.corpus import stopwords File "/usr/local/lib/python3.6/site-packages/nltk/corpus/__init__.py", line 66, in <module> from nltk.corpus.reader import * File "/usr/local/lib/python3.6/site-packages/nltk/corpus/reader/__init__.py", line 105, in <module> from nltk.corpus.reader.panlex_lite import * File "/usr/local/lib/python3.6/site-packages/nltk/corpus/reader/panlex_lite.py", line 15, in <module> import sqlite3 File "/usr/local/lib/python3.6/sqlite3/__init__.py", line 23, in <module> from sqlite3.dbapi2 import * File "/usr/local/lib/python3.6/sqlite3/dbapi2.py", line 27, in <module> from _sqlite3 import * ModuleNotFoundError: No module named '_sqlite3'
本来以为直接利用pip install pysqlite就可以
才发现pysqlite只支持python 2.0版本。
经过查找,这一问题还不少,不过还好,最终找到解决方案如下:
代码语言:javascript复制sudo apt-get install libsqlite-dev
然后再重新编译和安装一下python3.6,果然顺利通过。
具体还是: make -j8
sudo make install
实现完,重新测试一下:顺利通过。