{"id":12436,"date":"2024-04-01T13:38:10","date_gmt":"2024-04-01T05:38:10","guid":{"rendered":"https:\/\/blog.hoyo.idv.tw\/?p=12436"},"modified":"2024-08-05T15:18:17","modified_gmt":"2024-08-05T07:18:17","slug":"centos-7-%e5%ae%89%e8%a3%9d-python-3-10","status":"publish","type":"post","link":"https:\/\/blog.hoyo.idv.tw\/?p=12436","title":{"rendered":"CentOS 7 - \u5b89\u88dd Python 3.10"},"content":{"rendered":"<p>--<\/p>\n<h2>\u53c3\u8003\u8cc7\u6e90<\/h2>\n<ul>\n<li><a href=\"https:\/\/www.zhihu.com\/tardis\/zm\/art\/491817098?source_id=1003\" target=\"_blank\" rel=\"noopener\">Centos7\u5b89\u88c5Python3.10 (zhihu.com)<\/a><\/li>\n<\/ul>\n<p>--<\/p>\n<h2>Fix HTTP Error 404 Not Found Trying Other Mirror CentOS 7<\/h2>\n<ul>\n<li><a href=\"https:\/\/medium.com\/@bonguides25\/fix-http-error-404-not-found-trying-other-mirror-centos-7-1600e862644c\" target=\"_blank\" rel=\"noopener\">Fix HTTP Error 404 Not Found Trying Other Mirror CentOS 7 | by bonguides.com | Jul, 2024 | Medium<\/a><\/li>\n<\/ul>\n<pre class=\"lang:default decode:true \">sudo sed -i s\/mirror.centos.org\/vault.centos.org\/g \/etc\/yum.repos.d\/*.repo\r\nsudo sed -i s\/^#.*baseurl=http\/baseurl=http\/g \/etc\/yum.repos.d\/*.repo\r\nsudo sed -i s\/^mirrorlist=http\/#mirrorlist=http\/g \/etc\/yum.repos.d\/*.repo\r\nsudo -- bash -c 'echo \"sslverify=false\" &gt;&gt; \/etc\/yum.conf'\r\nsudo yum update<\/pre>\n<p>--<\/p>\n<h2>\u5b89\u88dd\u6d41\u7a0b<\/h2>\n<pre class=\"lang:default decode:true\">yum -y groupinstall \"Development tools\"\r\nyum install -y wget ncurses-devel gdbm-devel xz-devel sqlite-devel tk-devel uuid-devel readline-devel bzip2-devel libffi-devel openssl-devel openssl11 openssl11-devel\r\nmkdir -p tmp &amp;&amp; cd tmp\r\nwget https:\/\/www.python.org\/ftp\/python\/3.10.4\/Python-3.10.4.tgz\r\nexport CFLAGS=$(pkg-config --cflags openssl11)\r\nexport LDFLAGS=$(pkg-config --libs openssl11)\r\ntar xvzf Python-3.10.4.tgz\r\ncd Python-3.10.4\r\n.\/configure --enable-optimizations &amp;&amp; make altinstall\r\nln -sf \/usr\/local\/bin\/python3.10 \/usr\/bin\/python3\r\nln -sf \/usr\/local\/bin\/pip3.10  \/usr\/bin\/pip3<\/pre>\n<p>\u9014\u4e2d\u4e0d\u9700\u8981\u91cd\u65b0\u958b\u6a5f<\/p>\n<p>--<\/p>\n<h2>\u6210\u679c<\/h2>\n<pre class=\"lang:default decode:true \"># python3 --version\r\nPython 3.10.4<\/pre>\n<pre class=\"lang:default decode:true\"># pip3 --version\r\npip 22.0.4 from \/usr\/local\/lib\/python3.10\/site-packages\/pip (python 3.10)<\/pre>\n<p>--<\/p>\n<h2>pip3<\/h2>\n<pre class=\"lang:default decode:true\">pip3 install simplejson\r\npython3 -m pip install paho-mqtt==1.6.1<\/pre>\n<p>\u5982\u679c pip3 install \u7121\u6cd5\u5b89\u88dd\uff0c\u53ef\u4ee5\u63db\u6210 python3 -m pip install \u8a66\u8a66\u770b<\/p>\n<p>\u9700\u8981\u6307\u5b9a\u7248\u672c\uff0c\u5728\u540d\u7a31\u5f8c\u9762\u52a0\u4e0a == \u7248\u672c\u865f<\/p>\n<p>--<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p class=\"pvc_stats all \" data-element-id=\"12436\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> &nbsp;3,303&nbsp;total views, &nbsp;4&nbsp;views today<\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>-- \u53c3\u8003\u8cc7\u6e90 Centos7...<\/p>\n<div class=\"pvc_clear\"><\/div>\n<p class=\"pvc_stats all \" data-element-id=\"12436\" style=\"\"><i class=\"pvc-stats-icon medium\" aria-hidden=\"true\"><svg aria-hidden=\"true\" focusable=\"false\" data-prefix=\"far\" data-icon=\"chart-bar\" role=\"img\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" viewBox=\"0 0 512 512\" class=\"svg-inline--fa fa-chart-bar fa-w-16 fa-2x\"><path fill=\"currentColor\" d=\"M396.8 352h22.4c6.4 0 12.8-6.4 12.8-12.8V108.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v230.4c0 6.4 6.4 12.8 12.8 12.8zm-192 0h22.4c6.4 0 12.8-6.4 12.8-12.8V140.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v198.4c0 6.4 6.4 12.8 12.8 12.8zm96 0h22.4c6.4 0 12.8-6.4 12.8-12.8V204.8c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v134.4c0 6.4 6.4 12.8 12.8 12.8zM496 400H48V80c0-8.84-7.16-16-16-16H16C7.16 64 0 71.16 0 80v336c0 17.67 14.33 32 32 32h464c8.84 0 16-7.16 16-16v-16c0-8.84-7.16-16-16-16zm-387.2-48h22.4c6.4 0 12.8-6.4 12.8-12.8v-70.4c0-6.4-6.4-12.8-12.8-12.8h-22.4c-6.4 0-12.8 6.4-12.8 12.8v70.4c0 6.4 6.4 12.8 12.8 12.8z\" class=\"\"><\/path><\/svg><\/i> &nbsp;3,303&nbsp;total views, &nbsp;4&nbsp;views today<\/p>\n<div class=\"pvc_clear\"><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[31],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/12436"}],"collection":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=12436"}],"version-history":[{"count":8,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/12436\/revisions"}],"predecessor-version":[{"id":13176,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=\/wp\/v2\/posts\/12436\/revisions\/13176"}],"wp:attachment":[{"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12436"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=12436"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.hoyo.idv.tw\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=12436"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}