python3.4 之sqlite3,

2020-01-06 11:10:51 浏览数 (1)

python3.4导入sqlite3是报错,如下:

>>> import sqlite3

Traceback (most recent call last):

  File "<input>", line 1, in <module>

    import sqlite3

  File "/usr/local/python3.4/lib/python3.4/sqlite3/__init__.py", line 23, in <module>

    from sqlite3.dbapi2 import *

  File "/usr/local/python3.4/lib/python3.4/sqlite3/dbapi2.py", line 26, in <module>

    from _sqlite3 import *

ImportError: No module named '_sqlite3'

解决:

yum -y install sqlite-devel

重新编译安装python3.4

wget https://www.python.org/ftp/python/3.4.0/Python-3.4.0.tar.xz

./configure --enable-loadable-sqlite-extensions --prefix=/usr/local/python3.4

make&&make install

--------------------------------

ImportError: No module named 'pymysql'

python3 -m pip install pymysql

or

pip3 install pymysql

0 人点赞