一、问题
在执行pre-commit install --allow-missing-config
命令时,报错
Traceback (most recent call last):
File "C:\ProgramData\Anaconda3\envs\py38\lib\runpy.py", line 192, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\ProgramData\Anaconda3\envs\py38\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "D:\03-canway\01-code\ops-node-server\venv\Scripts\pre-commit.exe\__main__.py", line 4, in <module>
File "D:\03-canway\01-code\ops-node-server\venv\lib\site-packages\pre_commit\main.py", line 14, in <module>
from pre_commit.commands.clean import clean
File "D:\03-canway\01-code\ops-node-server\venv\lib\site-packages\pre_commit\commands\clean.py", line 6, in <module>
from pre_commit.store import Store
File "D:\03-canway\01-code\ops-node-server\venv\lib\site-packages\pre_commit\store.py", line 6, in <module>
import sqlite3
File "C:\ProgramData\Anaconda3\envs\py38\lib\sqlite3\__init__.py", line 23, in <module>
from sqlite3.dbapi2 import *
File "C:\ProgramData\Anaconda3\envs\py38\lib\sqlite3\dbapi2.py", line 27, in <module>
from _sqlite3 import *
ImportError: DLL load failed while importing _sqlite3: 找不到指定的模块。
二、解决办法
这个报错,其实是缺少了sqlite3.dll,解决措施如下:
- 去sqlite官网下载dll
- 解压文件,将
sqlite3.dll
和sqlite3.def
文件复制到Python环境的DLLs文件夹下。我用的是anaconda,所以我的文件路径是:C:\ProgramData\Anaconda3\envs\py38\DLLs
配置完之后,成功的效果: