python3.5, import sqlite3 show no module named _sqlite3 solution

Source: Internet
Author: User

I use the centos7.2, the system comes with python2.7.

I installed my own python3.5, but I did not find a package error when I imported the Sqlite3 package.

The workaround is given below.

The first type:

Check yourself if there's no installation sqlite-devel, no words

Yum-y Install Sqlite-devel

Then go to the Python directory, (CD python directory)

Then make and make install

This time you can enter Python, enter the python environment, import sqlite3, see will not error.

If it does, look at the second method, which I solved by the second one.

The second type:

Under command line, enter
Find/-name _sqlite3.so, see the path to this file, write down

Then enter Python, in the Python environment,

Import Syssys.path

See where the path to your Python package is, find/lib/python3.5/lib-dynload similar to this path

Next

cp/usr/lib64/python2.7/lib-dynload/_sqlite3.so/root/.virtualenvs/py3scrapy/lib/python3.5/lib-dynload/

Of course, these two paths are your own path, and you have to look at your own.

This time you can enter Python, enter the python environment, import sqlite3, see will not error.

Such a problem should be solved.

python3.5, import sqlite3 show no module named _sqlite3 solution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.