{"id":662,"date":"2022-03-29T23:20:32","date_gmt":"2022-03-29T15:20:32","guid":{"rendered":"http:\/\/47.98.165.52\/?p=662"},"modified":"2022-03-29T23:20:32","modified_gmt":"2022-03-29T15:20:32","slug":"python3%e8%a7%a3%e5%86%b3-modulenotfounderror-no-module-named-_ssl","status":"publish","type":"post","link":"\/?p=662","title":{"rendered":"python3\u89e3\u51b3 ModuleNotFoundError: No module named &#8216;_ssl&#8217;"},"content":{"rendered":"<h2>\u95ee\u9898\uff1a<\/h2>\n<p>\u5f53\u6211\u5728python3\u865a\u62df\u73af\u5883\u4e2d\u5bfc\u5165ssl\u6a21\u5757\u65f6\u62a5\u9519\uff0c\u62a5\u9519\u5982\u4e0b\uff1a<\/p>\n<pre><code class=\"language-shell\">(py3) [root@localhost Python-3.6.3]# python3\nPython 3.6.3 (default, Nov 19 2018, 14:18:18)\n[GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux\nType &quot;help&quot;, &quot;copyright&quot;, &quot;credits&quot; or &quot;license&quot; for more information.\n>&gt;&gt; import ssl\nTraceback (most recent call last):\n  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;\n  File &quot;\/usr\/local\/python3\/lib\/python3.6\/ssl.py&quot;, line 101, in &lt;module&gt;\n    import _ssl             # if we can&#039;t import it, let the error propagate\nModuleNotFoundError: No module named &#039;_ssl&#039;<\/code><\/pre>\n<h2>\u89e3\u51b3\uff1a<\/h2>\n<p>1.\u524d\u63d0\u662f\u5df2\u7ecf\u5b89\u88c5\u4e86openssl<\/p>\n<pre><code class=\"language-shell\">\u5982\u679c\u6ca1\u6309\u88c5\uff0c\u9700\u8981yum\u5b89\u88c5\n\u5b89\u88c5\u4f9d\u8d56\uff1ayum install openssl-devel <\/code><\/pre>\n<p>2.\u9996\u5148\u8fdb\u5165Python-3.6.3\u76ee\u5f55\uff0c\u5c31\u662f\u4f60\u89e3\u538b\u540e\u5b89\u88c5python3.6\u7684\u76ee\u5f55\u6587\u4ef6\u3002<br \/>\n3.cd \u5230 Modules \u76ee\u5f55\u91cc,\u627e\u5230Setup\u548cSetup.dist\u6587\u4ef6\uff0c\u5c06\u4e0b\u9762\u51e0\u884c\u6ce8\u91ca\u53bb\u6389\u3002<\/p>\n<ul>\n<li>Setup\u4e0b\u66f4\u6539<\/li>\n<li>vim Setup \uff08\u5927\u6982\u572851%\u7684\u4f4d\u7f6e\uff09<br \/>\n<img src=\"https:\/\/lemon-guess.oss-cn-hangzhou.aliyuncs.com\/1493082-20190725152716256-828228405.png\" alt=\"img\" \/><\/li>\n<li>Setup.dist\u4e0b\u7684\u66f4\u6539<\/li>\n<li>vim Setup.dist \uff08\u5927\u6982\u572850%\u7684\u4f4d\u7f6e\uff09<br \/>\n<img src=\"https:\/\/lemon-guess.oss-cn-hangzhou.aliyuncs.com\/1493082-20190725152736135-1432221283.png\" alt=\"img\" \/><br \/>\n4.\u7f16\u8bd1\u5b89\u88c5<\/p>\n<pre><code class=\"language-bash\">cd ..\n.\/configure --prefix=\/usr\/local\/python3\nmake &amp;&amp; make install<\/code><\/pre>\n<p>5.\u5220\u9664\u65e7\u7684\u8f6f\u8fde\u63a5\uff0c\u521b\u5efa\u65b0\u7684\u8f6f\u8fde\u63a5\uff08\u5f88\u91cd\u8981\uff09<\/p>\n<pre><code class=\"language-bash\">rm -rf \/usr\/bin\/python3\nln -s \/usr\/local\/bin\/python3.6 \/usr\/bin\/python3<\/code><\/pre>\n<\/li>\n<\/ul>\n<p>\u53c2\u8003\u94fe\u63a5\uff1a<a href=\"https:\/\/www.cnblogs.com\/hanfe1\/p\/13071020.html\">https:\/\/www.cnblogs.com\/hanfe1\/p\/13071020.html<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u95ee\u9898\uff1a \u5f53\u6211\u5728python3\u865a\u62df\u73af\u5883\u4e2d\u5bfc\u5165ssl\u6a21\u5757\u65f6\u62a5\u9519\uff0c\u62a5\u9519\u5982\u4e0b\uff1a (py3) [root@localhost Python-3.6   \u2026 &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0},"categories":[25],"tags":[],"_links":{"self":[{"href":"\/index.php?rest_route=\/wp\/v2\/posts\/662"}],"collection":[{"href":"\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=662"}],"version-history":[{"count":1,"href":"\/index.php?rest_route=\/wp\/v2\/posts\/662\/revisions"}],"predecessor-version":[{"id":663,"href":"\/index.php?rest_route=\/wp\/v2\/posts\/662\/revisions\/663"}],"wp:attachment":[{"href":"\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=662"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=662"},{"taxonomy":"post_tag","embeddable":true,"href":"\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=662"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}