当前位置: 首页 > 工具软件 > pysqlite > 使用案例 >

安装pysqlite

糜博远
2023-12-01

命令如下,如果有以下错误,请参看以下solution.

[root@localhost bin]# pip install pysqlite

Collecting pysqlite

/usr/local/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:90:InsecurePlatformWarning: A true SSLContext object is not available. Thisprevents urllib3 from configuring SSL appropriately and may cause certain SSLconnections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.

  InsecurePlatformWarning

  Using cached pysqlite-2.6.3.tar.gz

Building wheels for collected packages:pysqlite

  Running setup.py bdist_wheel for pysqlite

  Complete output from command/usr/local/bin/python2.7 -c "importsetuptools;__file__='/tmp/pip-build-SoLxpO/pysqlite/setup.py';exec(compile(open(__file__).read().replace('\r\n','\n'), __file__, 'exec'))" bdist_wheel -d /tmp/tmp65xKPypip-wheel-:

  running bdist_wheel

  running build

  running build_py

  creating build

  creating build/lib.linux-x86_64-2.7

  creatingbuild/lib.linux-x86_64-2.7/pysqlite2

  copying lib/dbapi2.py ->build/lib.linux-x86_64-2.7/pysqlite2

  copying lib/__init__.py -> build/lib.linux-x86_64-2.7/pysqlite2

  copying lib/dump.py ->build/lib.linux-x86_64-2.7/pysqlite2

  creatingbuild/lib.linux-x86_64-2.7/pysqlite2/test

  copying lib/test/dbapi.py ->build/lib.linux-x86_64-2.7/pysqlite2/test

  copying lib/test/__init__.py ->build/lib.linux-x86_64-2.7/pysqlite2/test

  copying lib/test/factory.py ->build/lib.linux-x86_64-2.7/pysqlite2/test

  copying lib/test/regression.py ->build/lib.linux-x86_64-2.7/pysqlite2/test

  copying lib/test/types.py ->build/lib.linux-x86_64-2.7/pysqlite2/test

  copying lib/test/hooks.py ->build/lib.linux-x86_64-2.7/pysqlite2/test

  copying lib/test/userfunctions.py-> build/lib.linux-x86_64-2.7/pysqlite2/test

  copying lib/test/transactions.py-> build/lib.linux-x86_64-2.7/pysqlite2/test

  copying lib/test/dump.py ->build/lib.linux-x86_64-2.7/pysqlite2/test

  creatingbuild/lib.linux-x86_64-2.7/pysqlite2/test/py25

  copying lib/test/py25/py25tests.py-> build/lib.linux-x86_64-2.7/pysqlite2/test/py25

  copying lib/test/py25/__init__.py-> build/lib.linux-x86_64-2.7/pysqlite2/test/py25

  running build_ext

  building 'pysqlite2._sqlite'extension

  creating build/temp.linux-x86_64-2.7

  creatingbuild/temp.linux-x86_64-2.7/src

  gcc -pthread -fno-strict-aliasing -g-O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC-DMODULE_NAME="pysqlite2.dbapi2" -DSQLITE_OMIT_LOAD_EXTENSION=1-I/usr/local/include/python2.7 -c src/module.c -obuild/temp.linux-x86_64-2.7/src/module.o

  In file included fromsrc/module.c:24:

  src/connection.h:33:21: error: sqlite3.h: No such file ordirectory

  In file included fromsrc/module.c:24:

  src/connection.h:38: error: expectedspecifier-qualifier-list before ‘sqlite3’

  In file included fromsrc/module.c:25:

  src/statement.h:37: error: expectedspecifier-qualifier-list before ‘sqlite3’

  src/module.c: In function‘module_complete’:

  src/module.c:103: warning: implicitdeclaration of function ‘sqlite3_complete’

  src/module.c: At top level:

  src/module.c:269: error: ‘SQLITE_OK’undeclared here (not in a function)

  src/module.c:270: error:‘SQLITE_DENY’ undeclared here (not in a function)

  src/module.c:271: error:‘SQLITE_IGNORE’ undeclared here (not in a function)

  src/module.c:272: error:‘SQLITE_CREATE_INDEX’ undeclared here (not in a function)

  src/module.c:273: error:‘SQLITE_CREATE_TABLE’ undeclared here (not in a function)

  src/module.c:274: error:‘SQLITE_CREATE_TEMP_INDEX’ undeclared here (not in a function)

  src/module.c:275: error:‘SQLITE_CREATE_TEMP_TABLE’ undeclared here (not in a function)

  src/module.c:276: error:‘SQLITE_CREATE_TEMP_TRIGGER’ undeclared here (not in a function)

  src/module.c:277: error:‘SQLITE_CREATE_TEMP_VIEW’ undeclared here (not in a function)

  src/module.c:278: error:‘SQLITE_CREATE_TRIGGER’ undeclared here (not in a function)

  src/module.c:279: error:‘SQLITE_CREATE_VIEW’ undeclared here (not in a function)

  src/module.c:280: error:‘SQLITE_DELETE’ undeclared here (not in a function)

  src/module.c:281: error:‘SQLITE_DROP_INDEX’ undeclared here (not in a function)

  src/module.c:282: error:‘SQLITE_DROP_TABLE’ undeclared here (not in a function)

  src/module.c:283: error:‘SQLITE_DROP_TEMP_INDEX’ undeclared here (not in a function)

  src/module.c:284: error:‘SQLITE_DROP_TEMP_TABLE’ undeclared here (not in a function)

  src/module.c:285: error:‘SQLITE_DROP_TEMP_TRIGGER’ undeclared here (not in a function)

  src/module.c:286: error:‘SQLITE_DROP_TEMP_VIEW’ undeclared here (not in a function)

  src/module.c:287: error:‘SQLITE_DROP_TRIGGER’ undeclared here (not in a function)

  src/module.c:288: error:‘SQLITE_DROP_VIEW’ undeclared here (not in a function)

  src/module.c:289: error:‘SQLITE_INSERT’ undeclared here (not in a function)

  src/module.c:290: error:‘SQLITE_PRAGMA’ undeclared here (not in a function)

  src/module.c:291: error:‘SQLITE_READ’ undeclared here (not in a function)

  src/module.c:292: error:‘SQLITE_SELECT’ undeclared here (not in a function)

  src/module.c:293: error:‘SQLITE_TRANSACTION’ undeclared here (not in a function)

  src/module.c:294: error: ‘SQLITE_UPDATE’undeclared here (not in a function)

  src/module.c:295: error:‘SQLITE_ATTACH’ undeclared here (not in a function)

  src/module.c:296: error:‘SQLITE_DETACH’ undeclared here (not in a function)

  src/module.c: In function‘init_sqlite’:

  src/module.c:426: warning: implicitdeclaration of function ‘sqlite3_libversion’

  src/module.c:426: warning: passingargument 1 of ‘PyString_FromString’ makes pointer from integer without a cast

 /usr/local/include/python2.7/stringobject.h:63: note: expected ‘const char *’but argument is of type ‘int’

  error: command 'gcc' failed withexit status 1

 

solution:

[root@localhost /]# yum installsqlite-devel

Loaded plugins: fastestmirror,refresh-packagekit, security

Setting up Install Process

Loading mirror speeds from cached hostfile

* base: mirrors.btte.net

* extras: ftp.sjtu.edu.cn

* updates: mirrors.pubyun.com

Resolving Dependencies

--> Running transaction check

---> Package sqlite-devel.x86_640:3.6.20-1.el6 will be installed

--> Finished Dependency Resolution

 

Dependencies Resolved

 

===========================================================================================================================================================================================

Package                                        Arch                                     Version                                          Repository                              Size

===========================================================================================================================================================================================

Installing:

sqlite-devel                                   x86_64                                   3.6.20-1.el6                                     base                                    81 k

 

Transaction Summary

===========================================================================================================================================================================================

Install      1 Package(s)

 

Total download size: 81 k

Installed size: 283 k

Is this ok [y/N]: y

Downloading Packages:

sqlite-devel-3.6.20-1.el6.x86_64.rpm                                                                                                                               | 81 kB     00:00

Running rpm_check_debug

Running Transaction Test

Transaction Test Succeeded

Running Transaction

  Installing :sqlite-devel-3.6.20-1.el6.x86_64                                                                                                                                       1/1

  Verifying  :sqlite-devel-3.6.20-1.el6.x86_64                                                                                                                                       1/1

 

Installed:

  sqlite-devel.x86_64 0:3.6.20-1.el6

 

Complete!

[root@localhost /]# pip install pysqlite

Collecting pysqlite

  Using cached pysqlite-2.6.3.tar.gz

Building wheels for collected packages:pysqlite

  Running setup.py bdist_wheel forpysqlite

  Stored in directory:/root/.cache/pip/wheels/75/77/78/15deb95f24b59fd8069b983ce61281f428277789478ff40919

Successfully built pysqlite

Installing collected packages: pysqlite

Successfully installed pysqlite-2.6.3

[root@localhost /]# l

 类似资料: