1. Preparing the installation Environment
' Development Tools ' Yum install zlib-devel bzip2-devel openssl-devel ncurses-devel
2. Installing Python3
Go to the official website to download the compiled installation package or directly execute the following command
wget HTTPS://WWW.PYTHON.ORG/FTP/PYTHON/3.6.2/PYTHON-3.6.2.TAR.XZ
Extract
TAR-XVJF PYTHON-3.6.2.TAR.XZ
Switch into
CD Python-3.6.2
Compiling the installation
./configure Prefix=/usr/local/python3
Make && make install
After installation, there will be python3 in the/usr/local/directory.
So we can add a soft link to the execution directory under/usr/bin
Ln-s/usr/local/python3/bin/python3/usr/bin/python3
Ln-s/USR/LOCAL/PYTHON3/BIN/PIP3/USR/BIN/PIP3
[[Email protected] ~]#Python3Python 3.6.2 (Default, Nov 15 2017, 03:44:12) [GCC4.8.5 20150623 (Red Hat 4.8.5-16)] on Linuxtype" Help","Copyright","credits" or "License" forMore information.>>>ImportSqlite3traceback (most recent): File"<stdin>", Line 1,inch<module>File"/usr/local/python3/lib/python3.6/sqlite3/__init__.py", line 23,inch<module> fromSqlite3.dbapi2Import*File"/usr/local/python3/lib/python3.6/sqlite3/dbapi2.py", line 27,inch<module> from_sqlite3Import*Modulenotfounderror:no module named'_sqlite3'
3. Installing Sqlite3
Official website http://www.sqlite.org/download.html
I downloaded: sqlite-autoconf-3210000.tar.gz
configure–prefix=/usr/local/sqlite3make make install
4. Installing Sqlite-devel
yum install sqlite-devel
5. Recompile the installation Python3
Edit the python3.6.2 inside the setup.py and add the SQLite search path:
Open with Vim setup.py, enter:
The/sqlite_inc_paths #用于寻找该字段 as follows:
[Email protected] python-3.6.2]# vim setup.py
Ok
Centos7 after installing Python3 and Django, Modulenotfounderror:no module named ' _sqlite3 '