{"id":433,"date":"2021-05-27T14:30:53","date_gmt":"2021-05-27T06:30:53","guid":{"rendered":"http:\/\/0004.xyz\/?p=433"},"modified":"2021-05-27T15:53:07","modified_gmt":"2021-05-27T07:53:07","slug":"centos7-python3-7-%e6%97%a0%e6%b3%95%e4%bd%bf%e7%94%a8sqlite3%e7%9a%84%e8%a7%a3%e5%86%b3%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"http:\/\/0004.xyz\/?p=433","title":{"rendered":"CentOS7 Python3.7 \u65e0\u6cd5\u4f7f\u7528sqlite3\u7684\u89e3\u51b3\u65b9\u6cd5"},"content":{"rendered":"<p>\u76f4\u63a5\u8fdb\u5165\u6b63\u9898<br \/>\n\u9519\u8bef\u5185\u5bb9\uff0c\u8bf4\u660e\u672a\u94fe\u63a5sqlite3\u6a21\u5757<\/p>\n<pre><code class=\"language-shell\">Type &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.\n>&gt;&gt; import sqlite3\nTraceback (most recent call last):\nFile &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;\nFile &quot;\/usr\/local\/python3\/lib\/python3.6\/sqlite3\/__init__.py&quot;, line 23, in &lt;module&gt;\nfrom sqlite3.dbapi2 import *\nFile &quot;\/usr\/local\/python3\/lib\/python3.6\/sqlite3\/dbapi2.py&quot;, line 27, in &lt;module&gt;\nfrom _sqlite3 import *\nModuleNotFoundError: No module named &#039;_sqlite3&#039;<\/code><\/pre>\n<h2>1\u3001\u5b89\u88c5sqlite3<\/h2>\n<p>\u5148\u6267\u884c<\/p>\n<pre><code class=\"language-shell\">sqlite3 -version<\/code><\/pre>\n<p>\u8f93\u51fa\u4e0b\u9762\u7684\u7248\u672c\u4fe1\u606f\u8bf4\u660e\u5df2\u7ecf\u5b89\u88c5\u4e86sqlite3\uff0c\u90a3\u76f4\u63a5\u8df3\u8fc71.1\uff0c\u8fdb\u884c1.2\u64cd\u4f5c<\/p>\n<pre><code class=\"language-shell\">[root@ns Python-3.7.0]# sqlite3 -version\n3.7.17 2013-05-20 00:56:22 118a3b35693b134d56ebd780123b7fd6f1497668<\/code><\/pre>\n<h3>1.1\u3001\u5b89\u88c5sqlite3<\/h3>\n<pre><code class=\"language-shell\">wget https:\/\/www.sqlite.org\/2021\/sqlite-autoconf-3350500.tar.gz\nconfigure \u2013prefix=\/usr\/local\/sqlite3\nmake\nmake install<\/code><\/pre>\n<h3>1.2\u3001\u5b89\u88c5 sqlite-devel<\/h3>\n<pre><code class=\"language-shell\">yum install sqlite-devel<\/code><\/pre>\n<h2>2\u3001\u914d\u7f6e\u5b89\u88c5python<\/h2>\n<p>\u7f16\u8f91python3.7\u76ee\u5f55\u91cc\u9762\u7684setup.py,\u6dfb\u52a0sqlite\u7684\u641c\u7d22\u8def\u5f84:<\/p>\n<pre><code class=\"language-shell\">vim setup.py\n\/*\u76f4\u63a5\u8f93\u5165\u4e0b\u9762\u7684\u5b57\u7b26,\u5c31\u80fd\u8df3\u8f6c\u5230\u6240\u5c5e\u884c\uff0cpython 3.7.0\u5927\u6982\u57281130\u884c\uff0c\u4e0d\u4f1avim\u7684\u53bb\u767e\u5ea6\u4e00\u4e0b\u554a\n\u952e\u76d8\/\u641c\u7d22\u5b57\u7b26\n\u952e\u76d8i\u8f93\u5165\u5b57\u7b26\n\u952e\u76d8:wq\u4fdd\u5b58\u6587\u4ef6\u5e76\u9000\u51fa\n\u952e\u76d8:q!\u5f3a\u5236\u9000\u51fa\uff0c\u4e0d\u4fdd\u5b58\u6587\u4ef6\n\u952e\u76d8esc\u53d6\u6d88\u547d\u4ee4\n*\/\n\/sqlite_inc_paths\n\u6539\u4e3a\u4ee5\u4e0b\u5185\u5bb9\uff0c\u589e\u52a0\u4e86\u540e3\u884c\n        sqlite_inc_paths = [ &#039;\/usr\/include&#039;,\n                             &#039;\/usr\/include\/sqlite&#039;,\n                             &#039;\/usr\/include\/sqlite3&#039;,\n                             &#039;\/usr\/local\/include&#039;,\n                             &#039;\/usr\/local\/include\/sqlite&#039;,\n                             &#039;\/usr\/local\/include\/sqlite3&#039;,\n                             &#039;\/usr\/local\/sqlite3\/include&#039;,\n                             &#039;\/usr\/local\/sqlite3\/include\/sqlite&#039;,\n                             &#039;\/usr\/local\/sqlite3\/include\/sqlite3&#039;,\n                             ]<\/code><\/pre>\n<h2>3\u3001\u91cd\u65b0\u5b89\u88c5python3.7<\/h2>\n<p>\u4e0b\u9762\u7684\u4ee3\u7801\u662f\u5e26SSL\u5b89\u88c5\u7684\uff0c\u5b89\u88c5\u65b9\u6cd5\u89c1\u4e0a\u4e00\u7bc7\u6587\u7ae0<br \/>\n<a href=\"http:\/\/0004.xyz\/archives\/431\" title=\"CentOS7 Python3.7 pip\u5b89\u88c5\u627e\u4e0d\u5230TLS\/SSL\u5904\u7406\u65b9\u5f0f\"><strong>CentOS7 Python3.7 pip\u5b89\u88c5\u627e\u4e0d\u5230TLS\/SSL\u5904\u7406\u65b9\u5f0f<\/strong><\/a><\/p>\n<pre><code class=\"language-shell\">LD_RUN_PATH=\/usr\/local\/lib .\/configure LDFLAGS=&quot;-L\/usr\/local\/lib&quot; CPPFLAGS=&quot;-I\/usr\/local\/include&quot; --with-openssl=\/usr\/local\/openssl\nLD_RUN_PATH=\/usr\/local\/lib make\nmake install<\/code><\/pre>\n<h2>3\u3001\u5b89\u88c5\u5b8c\u6210<\/h2>\n<pre><code class=\"language-shell\">[root@ns Python-3.7.0]# sqlite3 -version\n3.7.17 2013-05-20 00:56:22 118a3b35693b134d56ebd780123b7fd6f1497668\n[root@ns Python-3.7.0]# vim setup.py\n[root@ns Python-3.7.0]# \/usr\/local\/bin\/python3.7\nPython 3.7.0 (default, May 27 2021, 02:04:56) \n[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux\nType &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.\n>&gt;&gt; import sqlite3\n>&gt;&gt; sqlite3.sqlite_version\n&#039;3.7.17&#039;\n>&gt;&gt;<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u76f4\u63a5\u8fdb\u5165\u6b63\u9898 \u9519\u8bef\u5185\u5bb9\uff0c\u8bf4\u660e\u672a\u94fe\u63a5sqlite3\u6a21\u5757 Type &quot;help&quot;, &#038;quot [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"kt_blocks_editor_width":"","footnotes":""},"categories":[17],"tags":[8,569,570],"class_list":["post-433","post","type-post","status-publish","format-standard","hentry","category-share","tag-centos","tag-python","tag-sqlite"],"_links":{"self":[{"href":"http:\/\/0004.xyz\/index.php?rest_route=\/wp\/v2\/posts\/433","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/0004.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/0004.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/0004.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/0004.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=433"}],"version-history":[{"count":0,"href":"http:\/\/0004.xyz\/index.php?rest_route=\/wp\/v2\/posts\/433\/revisions"}],"wp:attachment":[{"href":"http:\/\/0004.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=433"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/0004.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=433"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/0004.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=433"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}