Ubuntu下啓動django項目報錯:ModuleNotFoundError: No module named '_sqlite3'

在Ubuntu系統中啓動Django項目報錯:ModuleNotFoundError: No module named '_sqlite3’

1.首先安裝缺失的sqlite3庫:

sudo apt-get install sqlite-devel 
或
sudo apt-get install libsqlite3-dev

2.如果上面的方法不行,重新下載編譯安裝sqlite3

sudo wget https://www.sqlite.org/2018/sqlite-autoconf-3250300.tar.gz

sudo tar zxvf sqlite-autoconf-3250300.tar.gz 

cd sqlite-autoconf-3250300

sudo ./configure

sudo make && make install

3.安裝結束後,進入到python源文件目錄下,重新編譯安裝python即可

sudo ./configure

sudo make && make install

4.進入到django項目下啓動項目:

python3 manage.py runserver

項目順利運行:

root@ubuntu:/home/fanzhh/projects/mysite# python3 manage.py runserver
Watching for file changes with StatReloader
Performing system checks...

System check identified no issues (0 silenced).

You have 17 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.

September 05, 2019 - 07:01:05
Django version 2.2.5, using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章