{"id":681,"date":"2022-03-13T10:44:33","date_gmt":"2022-03-13T02:44:33","guid":{"rendered":"https:\/\/zseay.com\/?p=681"},"modified":"2022-03-25T23:00:55","modified_gmt":"2022-03-25T15:00:55","slug":"%e4%b8%bacentos7%e5%8d%87%e7%ba%a7python3","status":"publish","type":"post","link":"https:\/\/zseay.com\/index.php\/2022\/03\/13\/%e4%b8%bacentos7%e5%8d%87%e7%ba%a7python3\/","title":{"rendered":"\u4e3aCentos7\u5347\u7ea7Python3"},"content":{"rendered":"\n<p>\u6700\u8fd1\u5c06python\u9879\u76ee\u90e8\u7f72\u5230Centos\u670d\u52a1\u5668\u4e0a\u65f6\u53d1\u73b0\u65e0\u6cd5\u8fd0\u884c\uff0c\u539f\u56e0\u662f\u6709\u4e9b\u65b0\u529f\u80fd\u5728Python3\u4e2d\u65b0\u6dfb\u52a0\uff0c\u800c\u7cfb\u7edf\u81ea\u5e26\u7684ptyhon\u7248\u672c\u4e3a2.75\uff0c\u4e8e\u662f\u6b32\u5c06\u7cfb\u7edf\u81ea\u5e26Python\u8fdb\u884c\u5347\u7ea7\u3002\u5199\u4e0b\u672c\u6587\u6d41\u7a0b\u6765\u68b3\u7406\u4e0b\u6d41\u7a0b\u4ee5\u53ca\u8e29\u8fc7\u7684\u5751<br><strong>\u7cfb\u7edf\uff1aCentos7.3 <br>\u539fPython\u7248\u672c\uff1a2.75<br>\u76ee\u6807Python\u7248\u672c\uff1a3.8.0<\/strong><\/p>\n\n\n\n<p>PS\uff1a\u539f\u6765\u6b65\u9aa4\u662f<\/p>\n\n\n\n<ul><li>\u4e0b\u8f7dPython3.8\u538b\u7f29\u5305<\/li><li>\u89e3\u538b\u538b\u7f29\u5305<\/li><li>\u521b\u5efa\u5b89\u88c5\u8def\u5f84<\/li><li>\u7f16\u8bd1\u548c\u5b89\u88c5<\/li><li>\u521b\u5efa\u8f6f\u8fde\u63a5<\/li><li>Python3  \u547d\u4ee4\u53ef\u6b63\u5e38\u4f7f\u7528<\/li><\/ul>\n\n\n\n<p><strong>\u4f46\u662f\u5728\u5b9e\u9645\u8fc7\u7a0b\u4e2d\u53d1\u73b0\u82e5\u6309\u6b64\u64cd\u4f5c\u5b89\u88c5\u5b8c\u4f1a\u51fa\u73b0\u65b0\u7684pip3 install \u547d\u4ee4\u65e0\u6cd5\u4f7f\u7528\uff0c\u663e\u793apip3\u65e0\u6cd5\u4f7f\u7528SSL\u670d\u52a1\u3002<br>\u67e5\u9605\u8d44\u6599\u540e\u53d1\u73b0\uff0c\u5728Centos7\u4e2d\u81ea\u5e26\u7684OpenSSL\u7248\u672c\u8fc7\u4f4e\uff0c\u5728\u5b89\u88c5\u540ePython3\u540e\u65e0\u6cd5\u8c03\u7528OpenSSL\uff0c\u6240\u4ee5\u8fd8\u5148\u9700\u5b89\u88c5\u9ad8\u7248\u672c\u7684OpenSSL\uff0c\u800c\u4e14\u5728\u7f16\u8bd1python3\u5b89\u88c5\u65f6\u6307\u5b9a\u5bf9\u5e94OpenSSL\u7684\u76ee\u5f55\uff0c\u6700\u540e\u89e3\u51b3\u95ee\u9898\u3002<\/strong><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u4e00.\u51c6\u5907\u5de5\u4f5c\uff1a<\/h3>\n\n\n\n<p>1.\u83b7\u53d6Root\u6743\u9650<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo -i <\/code><\/pre>\n\n\n\n<p>2.\u7cfb\u7edf\u53ef\u80fd\u6ca1\u6709\u81ea\u5e26gcc\uff0c\u9996\u5148\u5b89\u88c5gcc\u7f16\u8bd1\u5de5\u5177\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>yum -y install gcc <\/code><\/pre>\n\n\n\n<p>3.\u5b89\u88c5Python3\u65f6\u6240\u9700\u8981\u7684\u4f9d\u8d56\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>yum install zlib-devel bzip2 bzip2-devel readline-devel sqlite sqlite-devel openssl-devel xz xz-devel libffi-devel <\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u4e8c.\u5b89\u88c5\u65b0\u7248\u672c\u7684OpenSSL<\/h3>\n\n\n\n<p>1.\u9996\u5148\u5207\u6362\u5de5\u4f5c\u76ee\u5f55\u81f3\/user\/local,\u5728Linux\u7cfb\u7edf\u4e0b\uff0c\u8def\u5f84\/usr\/local\u76f8\u5f53\u4e8eC:\/Progrem Files\/\uff0c\u901a\u5e38\u5b89\u88c5\u8f6f\u4ef6\u65f6\u4fbf\u5b89\u88c5\u5230\u6b64\u76ee\u5f55\u4e0b\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd \/usr\/local\n<\/code><\/pre>\n\n\n\n<p>2.\u4e0b\u8f7d1.1\u7248\u672c\u7684OpenSSL<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wget https:\/\/github.com\/openssl\/openssl\/archive\/OpenSSL_1_1_1d.tar.gz\n<\/code><\/pre>\n\n\n\n<p>3.\u89e3\u538b\u6587\u4ef6<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tar -zxvf OpenSSL_1_1_1d.tar.gz<\/code><\/pre>\n\n\n\n<p>4.\u79fb\u52a8\u76ee\u5f55\u5230\u89e3\u538b\u540e\u7684\u76ee\u5f55<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd  openssl-OpenSSL_1_1_1d\n<\/code><\/pre>\n\n\n\n<p>5.\u7f16\u8bd1&amp;\u5b89\u88c5\uff08\u9010\u884c\u8fd0\u884c\uff09<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.\/config --prefix=\/usr\/local\/openssl\nmake &amp;&amp; make install<\/code><\/pre>\n\n\n\n<p>6.\u4fdd\u5b58\u539f\u6765\u7684\u65e7\u7248\u672cOpenSSL(\u9010\u884c\u8fd0\u884c)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mv \/usr\/bin\/openssl \/usr\/bin\/openssl.old\nmv \/usr\/lib64\/openssl \/usr\/lib64\/openssl.old\nmv \/usr\/lib64\/libssl.so \/usr\/lib64\/libssl.so.old<\/code><\/pre>\n\n\n\n<p>7.\u66ff\u6362\u6210\u65b0\u5b89\u88c5\u7684OpenSSL\uff08\u9010\u884c\u8fd0\u884c\uff09<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ln -s \/usr\/local\/openssl\/bin\/openssl \/usr\/bin\/openssl\nln -s \/usr\/local\/openssl\/include\/openssl \/usr\/include\/openssl\nln -s \/usr\/local\/openssl\/lib\/libssl.so \/usr\/lib64\/libssl.so\necho \"\/usr\/local\/openssl\/lib\" &gt;&gt; \/etc\/ld.so.conf\nldconfig -v\n<\/code><\/pre>\n\n\n\n<p>8.\u67e5\u770b\u7cfb\u7edfOpenSSL\u7248\u672c<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>openssl version<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"602\" height=\"63\" data-src=\"https:\/\/zseay-file-1304998509.cos.ap-shanghai.myqcloud.com\/TXServer01\/2022\/03\/image-13.png\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/Fuukei\/Public_Repository@latest\/vision\/load_svg\/inload.svg\" onerror=\"imgError(this)\" alt=\"\" class=\"wp-image-688 lazyload\" data-srcset=\"https:\/\/zseay.com\/wp-content\/uploads\/2022\/03\/image-13.png 602w, https:\/\/zseay.com\/wp-content\/uploads\/2022\/03\/image-13-300x31.png 300w\" sizes=\"(max-width: 602px) 100vw, 602px\" \/><noscript><img decoding=\"async\" loading=\"lazy\" width=\"602\" height=\"63\" src=\"https:\/\/zseay-file-1304998509.cos.ap-shanghai.myqcloud.com\/TXServer01\/2022\/03\/image-13.png\" alt=\"\" class=\"wp-image-688\" srcset=\"https:\/\/zseay.com\/wp-content\/uploads\/2022\/03\/image-13.png 602w, https:\/\/zseay.com\/wp-content\/uploads\/2022\/03\/image-13-300x31.png 300w\" sizes=\"(max-width: 602px) 100vw, 602px\" \/><\/noscript><\/figure>\n\n\n\n<p>\u663e\u793a\u4e3a1.1.1d\u7248\u672c\uff0c\u8868\u793a\u65b0\u7248\u7684OpenSSL\u5b89\u88c5\u6210\u529f\u4e86\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u4e09.\u5b89\u88c5Python3<\/h3>\n\n\n\n<p>1.\u540c\u6837\u79fb\u52a8\u5de5\u4f5c\u76ee\u5f55<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd \/usr\/local\n<\/code><\/pre>\n\n\n\n<p>2.\u4e0b\u8f7dPython3\u7684\u5b89\u88c5\u5305\uff0c\u5305\u6e90\u5728\u963f\u91cc\u670d\u52a1\u5668\uff0c\u901f\u5ea6\u5f88\u5feb<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wget http:\/\/npm.taobao.org\/mirrors\/python\/3.8.0\/Python-3.8.0.tgz\n<\/code><\/pre>\n\n\n\n<p>3.\u89e3\u538b\u7f29\u5b89\u88c5\u5305<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>tar -xzf Python-3.8.0.tgz\n<\/code><\/pre>\n\n\n\n<p>4.\u521b\u5efaPython3\u6587\u4ef6\u5939\uff0c\u8fd9\u4e2a\u662f\u6700\u540ePython3\u5b89\u88c5\u5728\u8fd9\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir python3\n<\/code><\/pre>\n\n\n\n<p>5.\u8fdb\u5165\u521a\u521a\u89e3\u538b\u7f29\u7684\u6587\u4ef6\u5939\uff0c\u4e0d\u662f\u521a\u624d\u65b0\u5efa\u7684Python3\u6587\u4ef6\u5939<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd Python-3.8.0\n<\/code><\/pre>\n\n\n\n<p>6.\u7f16\u5199\u5b89\u88c5\u914d\u7f6e\uff0c\u8fd9\u91cc\u662f\u6307\u660e\u4e86\u5b89\u88c5\u76ee\u6807\u8def\u5f84\u4e3a\u521a\u521a\u65b0\u5efa\u7684Python3\u6587\u4ef6\u5939\uff0c\u540c\u65f6\u544a\u77e5\u4e86OpenSSL\u7684\u8def\u5f84<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>.\/configure --prefix=\/usr\/local\/python3 --with-openssl=\/usr\/local\/openssl\n<\/code><\/pre>\n\n\n\n<p>7.\u7f16\u8bd1&amp;\u5b89\u88c5<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>make &amp;&amp; make install<\/code><\/pre>\n\n\n\n<p>8.\u6536\u5c3e\u5904\u7406\uff0c\u8fd9\u91cc\u91c7\u7528\u5efa\u7acb\u8f6f\u94fe\u63a5\u7684\u65b9\u5f0f\u6765\u8c03\u7528Python3<br>\u5373\u8868\u73b0\u4e3a\uff1apython\u547d\u4ee4\u8c03\u7528\u539f\u6765\u7684python2.7.5,pip\u547d\u4ee4\u8c03\u7528\u539f\u6765\u5bf9\u5e94\u7684pip<br>python3\u547d\u4ee4\u8c03\u7528\u65b0\u7248\u7684python3.8.0\uff0cpip3\u547d\u4ee4\u8c03\u7528\u65b0\u7248\u672c\u7684pip<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ln -s \/usr\/local\/python3\/bin\/python3 \/usr\/bin\/python3\nln -s \/usr\/local\/python3\/bin\/pip3 \/usr\/bin\/pip3\n<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">\u56db.\u4f7f\u7528\u793a\u4f8b<\/h3>\n\n\n\n<p>\u524d\u4e09\u90e8\u5c31\u5df2\u7ecf\u5c06\u65b0\u7248\u7684Python\u5b89\u88c5\u5b8c\u6bd5\u4e86\uff0c\u4e0b\u9762\u7b80\u4ecb\u4e0b\u600e\u4e48\u4f7f\u7528<br>\u65b0\u65e7\u5bf9\u6bd4\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>python3 -v<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"472\" data-src=\"https:\/\/zseay-file-1304998509.cos.ap-shanghai.myqcloud.com\/TXServer01\/2022\/03\/image-14-1024x472.png\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/Fuukei\/Public_Repository@latest\/vision\/load_svg\/inload.svg\" onerror=\"imgError(this)\" alt=\"\" class=\"wp-image-690 lazyload\" data-srcset=\"https:\/\/zseay.com\/wp-content\/uploads\/2022\/03\/image-14-1024x472.png 1024w, https:\/\/zseay.com\/wp-content\/uploads\/2022\/03\/image-14-300x138.png 300w, https:\/\/zseay.com\/wp-content\/uploads\/2022\/03\/image-14-768x354.png 768w, https:\/\/zseay.com\/wp-content\/uploads\/2022\/03\/image-14-1536x708.png 1536w, https:\/\/zseay.com\/wp-content\/uploads\/2022\/03\/image-14.png 1836w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><noscript><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"472\" src=\"https:\/\/zseay-file-1304998509.cos.ap-shanghai.myqcloud.com\/TXServer01\/2022\/03\/image-14-1024x472.png\" alt=\"\" class=\"wp-image-690\" srcset=\"https:\/\/zseay.com\/wp-content\/uploads\/2022\/03\/image-14-1024x472.png 1024w, https:\/\/zseay.com\/wp-content\/uploads\/2022\/03\/image-14-300x138.png 300w, https:\/\/zseay.com\/wp-content\/uploads\/2022\/03\/image-14-768x354.png 768w, https:\/\/zseay.com\/wp-content\/uploads\/2022\/03\/image-14-1536x708.png 1536w, https:\/\/zseay.com\/wp-content\/uploads\/2022\/03\/image-14.png 1836w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/noscript><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code>python -v<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"480\" data-src=\"https:\/\/zseay-file-1304998509.cos.ap-shanghai.myqcloud.com\/TXServer01\/2022\/03\/image-15-1024x480.png\" src=\"https:\/\/cdn.jsdelivr.net\/gh\/Fuukei\/Public_Repository@latest\/vision\/load_svg\/inload.svg\" onerror=\"imgError(this)\" alt=\"\" class=\"wp-image-691 lazyload\" data-srcset=\"https:\/\/zseay.com\/wp-content\/uploads\/2022\/03\/image-15-1024x480.png 1024w, https:\/\/zseay.com\/wp-content\/uploads\/2022\/03\/image-15-300x140.png 300w, https:\/\/zseay.com\/wp-content\/uploads\/2022\/03\/image-15-768x360.png 768w, https:\/\/zseay.com\/wp-content\/uploads\/2022\/03\/image-15-1536x719.png 1536w, https:\/\/zseay.com\/wp-content\/uploads\/2022\/03\/image-15.png 1687w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><noscript><img decoding=\"async\" loading=\"lazy\" width=\"1024\" height=\"480\" src=\"https:\/\/zseay-file-1304998509.cos.ap-shanghai.myqcloud.com\/TXServer01\/2022\/03\/image-15-1024x480.png\" alt=\"\" class=\"wp-image-691\" srcset=\"https:\/\/zseay.com\/wp-content\/uploads\/2022\/03\/image-15-1024x480.png 1024w, https:\/\/zseay.com\/wp-content\/uploads\/2022\/03\/image-15-300x140.png 300w, https:\/\/zseay.com\/wp-content\/uploads\/2022\/03\/image-15-768x360.png 768w, https:\/\/zseay.com\/wp-content\/uploads\/2022\/03\/image-15-1536x719.png 1536w, https:\/\/zseay.com\/wp-content\/uploads\/2022\/03\/image-15.png 1687w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/noscript><\/figure>\n\n\n\n<p>\u53ef\u4ee5\u770b\u5230\u8981\u4f7f\u7528python3\uff0c\u4ee5\u540e\u6267\u884c\u547d\u4ee4\u65f6\u4f7f\u7528<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>python3  xxxx.py<\/code><\/pre>\n\n\n\n<p>\u540c\u7406\uff0c\u4f7f\u7528Python3\u5bf9\u5e94pip\u65f6\u547d\u4ee4\u4f7f\u7528<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pip3 install   xxxx<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u6700\u8fd1\u5c06python\u9879\u76ee\u90e8\u7f72\u5230Centos\u670d\u52a1\u5668\u4e0a\u65f6\u53d1\u73b0\u65e0\u6cd5\u8fd0\u884c\uff0c\u539f\u56e0\u662f\u6709\u4e9b\u65b0\u529f\u80fd\u5728Python3\u4e2d\u65b0\u6dfb\u52a0\uff0c\u800c\u7cfb\u7edf\u81ea\u5e26\u7684ptyhon &#8230;<\/p>","protected":false},"author":1,"featured_media":696,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[14],"tags":[16,17,15],"_links":{"self":[{"href":"https:\/\/zseay.com\/index.php\/wp-json\/wp\/v2\/posts\/681"}],"collection":[{"href":"https:\/\/zseay.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zseay.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zseay.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zseay.com\/index.php\/wp-json\/wp\/v2\/comments?post=681"}],"version-history":[{"count":12,"href":"https:\/\/zseay.com\/index.php\/wp-json\/wp\/v2\/posts\/681\/revisions"}],"predecessor-version":[{"id":800,"href":"https:\/\/zseay.com\/index.php\/wp-json\/wp\/v2\/posts\/681\/revisions\/800"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/zseay.com\/index.php\/wp-json\/wp\/v2\/media\/696"}],"wp:attachment":[{"href":"https:\/\/zseay.com\/index.php\/wp-json\/wp\/v2\/media?parent=681"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zseay.com\/index.php\/wp-json\/wp\/v2\/categories?post=681"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zseay.com\/index.php\/wp-json\/wp\/v2\/tags?post=681"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}