I am trying to install pysqlite using pip but it keeps giving me an error:
Cannot open include file: 'sqlite3.h': No such file or directory
I'm using Windows 10 OS 64 bit. Python version 2.7.13. I'm trying to install using pip. (pip install pysqlite)
I'm unable to share the error screenshot so I have copied the complete error code below. If anyone can help me, that will be great. Thank you.
The complete cmd looks like this:
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\
Screenshot is here
I had the same issue and managed to solve it this way:
.\lib.exe /DEF:sqlite3.def /MACHINE:X86
.\lib.exe /DEF:sqlite3.def /MACHINE:X64
pip install pysqlite
As far as i can remember sqlite3 is inbuilt in python2.x and python3.x