我正在尝试使用pip安装pysqlite,但它一直给我一个错误:
无法打开包含文件:' sqlite3.h':没有这样的文件或目录
我使用的是Windows 10 OS 64位。 Python版本2.7.13。我尝试使用pip进行安装。 (pip install pysqlite)
我无法分享错误屏幕截图,因此我复制了以下完整的错误代码。如果有人能帮助我,那将是伟大的。 谢谢。
完整的cmd如下所示:
C:\Users\Who Are You>pip install pysqlite
Collecting pysqlite
Using cached pysqlite-2.8.3.tar.gz
Installing collected packages: pysqlite
Running setup.py install for pysqlite ... error
Complete output from command c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\whoare~1\\appdata\\local\\temp\\pip-build-0ju9tj\\pysqlite\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:\users\whoare~1\appdata\local\temp\pip-0cieyz-record\install-record.txt --single-version-externally-managed --compile:
running install
running build
running build_py
creating build
creating build\lib.win32-2.7
creating build\lib.win32-2.7\pysqlite2
copying lib\dbapi2.py -> build\lib.win32-2.7\pysqlite2
copying lib\dump.py -> build\lib.win32-2.7\pysqlite2
copying lib\__init__.py -> build\lib.win32-2.7\pysqlite2
creating build\lib.win32-2.7\pysqlite2\test
copying lib\test\dbapi.py -> build\lib.win32-2.7\pysqlite2\test
copying lib\test\dump.py -> build\lib.win32-2.7\pysqlite2\test
copying lib\test\factory.py -> build\lib.win32-2.7\pysqlite2\test
copying lib\test\hooks.py -> build\lib.win32-2.7\pysqlite2\test
copying lib\test\regression.py -> build\lib.win32-2.7\pysqlite2\test
copying lib\test\transactions.py -> build\lib.win32-2.7\pysqlite2\test
copying lib\test\types.py -> build\lib.win32-2.7\pysqlite2\test
copying lib\test\userfunctions.py -> build\lib.win32-2.7\pysqlite2\test
copying lib\test\__init__.py -> build\lib.win32-2.7\pysqlite2\test
running build_ext
building 'pysqlite2._sqlite' extension
creating build\temp.win32-2.7
creating build\temp.win32-2.7\Release
creating build\temp.win32-2.7\Release\src
C:\Users\Who Are You\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -DMODULE_NAME=\"pysqlite2.dbapi2\" -I'{' -Iis -Inot -Irecognized -Ias -Ian -Iinternal -Ior -Iexternal -Icommand, -Ioperable -Iprogram -Ior -Ibatch -Ifile. -Ic:\python27\include -Ic:\python27\PC /Tcsrc/module.c /Fobuild\temp.win32-2.7\Release\src/module.obj
module.c
c:\users\who are you\appdata\local\temp\pip-build-0ju9tj\pysqlite\src\connection.h(33) : fatal error C1083: Cannot open include file: 'sqlite3.h': No such file or directory
error: command 'C:\\Users\\Who Are You\\AppData\\Local\\Programs\\Common\\Microsoft\\Visual C++ for Python\\9.0\\VC\\Bin\\cl.exe' failed with exit status 2
----------------------------------------
Command "c:\python27\python.exe -u -c "import setuptools, tokenize;__file__='c:\\users\\whoare~1\\appdata\\local\\temp\\pip-build-0ju9tj\\pysqlite\\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:\users\whoare~1\appdata\local\temp\pip-0cieyz-record\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:\users\whoare~1\appdata\local\temp\pip-build-0ju9tj\pysqlite\
屏幕截图为here
答案 0 :(得分:0)
我遇到了同样的问题,并设法通过以下方式解决了这个问题:
.\lib.exe /DEF:sqlite3.def /MACHINE:X86
.\lib.exe /DEF:sqlite3.def /MACHINE:X64
pip install pysqlite
答案 1 :(得分:-1)
据我所知,sqlite3内置于python2.x和python3.x