{"id":16331,"date":"2024-11-18T09:49:04","date_gmt":"2024-11-18T01:49:04","guid":{"rendered":"https:\/\/fwq.ai\/blog\/16331\/"},"modified":"2024-11-18T09:49:04","modified_gmt":"2024-11-18T01:49:04","slug":"python%e6%9c%89linux%e7%89%88%e5%90%97","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/16331\/","title":{"rendered":"python\u6709linux\u7248\u5417"},"content":{"rendered":"<blockquote><p>\n  python\u6709linux\u7248\uff0c\u5b89\u88c5\u548c\u8fd0\u884c\u6b65\u9aa4\u662f\uff1a1\u3001\u68c0\u67e5\u7cfb\u7edf\u662f\u5426\u5df2\u7ecf\u5b89\u88c5python\uff1b2\u3001\u5982\u679c\u6ca1\u6709\u5b89\u88c5\uff0c\u4f7f\u7528\u5305\u7ba1\u7406\u5668\u8fdb\u884c\u5b89\u88c5\uff1b3\u3001\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u6267\u884c\u201cpython &#8211;version\u201d\u547d\u4ee4\u786e\u8ba4python\u662f\u5426\u6210\u529f\u5b89\u88c5\uff1b4\u3001\u5728\u7ec8\u7aef\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u201cpython \/path\/to\/your_script.py\u201d\u547d\u4ee4\u6765\u8fd0\u884cpython\u811a\u672c\u6587\u4ef6\u5373\u53ef\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202307\/14\/2023071417040491169.jpg\" class=\"aligncenter\" title=\"python\u6709linux\u7248\u5417\u63d2\u56fe\" alt=\"python\u6709linux\u7248\u5417\u63d2\u56fe\" \/><\/p>\n<p>\u672c\u6559\u7a0b\u64cd\u4f5c\u7cfb\u7edf\uff1aLinux5.18.14\u7cfb\u7edf\u3001Dell G3\u7535\u8111\u3002<\/p>\n<p>Python \u662f\u4e00\u79cd\u8de8\u5e73\u53f0\u7684\u7f16\u7a0b\u8bed\u8a00\uff0c\u53ef\u4ee5\u5728 Linux \u7cfb\u7edf\u4e0a\u8fd0\u884c\u3002\u4e8b\u5b9e\u4e0a\uff0cPython \u5728 Linux \u4e0a\u7684\u652f\u6301\u975e\u5e38\u5e7f\u6cdb\uff0c\u51e0\u4e4e\u6240\u6709\u7684 Linux \u53d1\u884c\u7248\u90fd\u5185\u7f6e\u4e86 Python \u89e3\u91ca\u5668\u3002<\/p>\n<p>\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u5728 Linux \u4e0a\u5b89\u88c5\u548c\u8fd0\u884c Python\uff1a<\/p>\n<p><strong>1\u3001\u68c0\u67e5\u7cfb\u7edf\u662f\u5426\u5df2\u7ecf\u5b89\u88c5 Python\uff1a<\/strong><\/p>\n<p><span>\u7acb\u5373\u5b66\u4e60<\/span>\u201c\u201d\uff1b<\/p>\n<p>\u6253\u5f00\u7ec8\u7aef\uff0c\u5e76\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u68c0\u67e5\u7cfb\u7edf\u662f\u5426\u5df2\u7ecf\u5b89\u88c5\u4e86 Python\uff1a<\/p>\n<pre>&nbsp;&nbsp;python&nbsp;--version<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5982\u679c\u5df2\u7ecf\u5b89\u88c5\uff0c\u5219\u4f1a\u663e\u793a Python \u7684\u7248\u672c\u4fe1\u606f\u3002\u5982\u679c\u6ca1\u6709\u5b89\u88c5\uff0c\u5c06\u4f1a\u63d0\u793a\u627e\u4e0d\u5230\u547d\u4ee4\u3002<\/p>\n<p><strong>2\u3001\u5b89\u88c5 Python\uff1a<\/strong><\/p>\n<p>\u5982\u679c\u7cfb\u7edf\u4e2d\u6ca1\u6709\u5b89\u88c5 Python\uff0c\u53ef\u4ee5\u4f7f\u7528\u5305\u7ba1\u7406\u5668\u6765\u5b89\u88c5\u3002<\/p>\n<p>\u4f8b\u5982\uff1aCentOS\u3001RHEL \u7b49\u4f7f\u7528 yum \u5305\u7ba1\u7406\u5668\u7684\u53d1\u884c\u7248<\/p>\n<pre>&nbsp;sudo&nbsp;yum&nbsp;install&nbsp;python<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>3\u3001\u9a8c\u8bc1\u5b89\u88c5\u7ed3\u679c\uff1a<\/strong><\/p>\n<p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u518d\u6b21\u6267\u884c&nbsp;python &#8211;version&nbsp;\u547d\u4ee4\u53ef\u4ee5\u786e\u8ba4 Python \u662f\u5426\u6210\u529f\u5b89\u88c5\uff0c\u5e76\u663e\u793a\u5176\u7248\u672c\u4fe1\u606f\u3002<\/p>\n<p><strong>4\u3001\u8fd0\u884c Python \u811a\u672c\uff1a<\/strong><\/p>\n<p>\u5728\u7ec8\u7aef\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6765\u8fd0\u884c Python \u811a\u672c\u6587\u4ef6\uff1a<\/p>\n<pre>&nbsp;&nbsp;python&nbsp;\/path\/to\/your_script.py<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5176\u4e2d&nbsp;\/path\/to\/your_script.py&nbsp;\u662f\u4f60\u7684 Python \u811a\u672c\u6587\u4ef6\u7684\u8def\u5f84\u3002<\/p>\n<p>\u8bf7\u6ce8\u610f\uff0c\u4e0a\u8ff0\u6b65\u9aa4\u662f\u4e00\u822c\u60c5\u51b5\u4e0b\u5728 Linux \u7cfb\u7edf\u4e0a\u5b89\u88c5\u548c\u8fd0\u884c Python \u7684\u65b9\u5f0f\u3002\u5177\u4f53\u7684\u64cd\u4f5c\u53ef\u80fd\u56e0\u53d1\u884c\u7248\u548c\u7cfb\u7edf\u914d\u7f6e\u800c\u6709\u6240\u4e0d\u540c\u3002\u5982\u679c\u9047\u5230\u95ee\u9898\uff0c\u4f60\u53ef\u4ee5\u53c2\u8003\u76f8\u5173\u6587\u6863\u6216\u793e\u533a\u8d44\u6e90\uff0c\u4ee5\u83b7\u53d6\u66f4\u8be6\u7ec6\u7684\u6307\u5bfc\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fpython\u6709\u7248\u5417\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>python\u6709linux\u7248\uff0c\u5b89\u88c5\u548c\u8fd0\u884c\u6b65\u9aa4\u662f\uff1a1\u3001\u68c0\u67e5\u7cfb\u7edf\u662f\u5426\u5df2\u7ecf\u5b89\u88c5python\uff1b2\u3001\u5982\u679c\u6ca1\u6709\u5b89\u88c5\uff0c\u4f7f\u7528\u5305\u7ba1\u7406\u5668\u8fdb\u884c\u5b89\u88c5\uff1b3\u3001\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u6267\u884c\u201cpython &#8211;version\u201d\u547d\u4ee4\u786e\u8ba4python\u662f\u5426\u6210\u529f\u5b89\u88c5\uff1b4\u3001\u5728\u7ec8\u7aef\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u201cpython \/path\/to\/your_script.py\u201d\u547d\u4ee4\u6765\u8fd0\u884cpython\u811a\u672c\u6587\u4ef6\u5373\u53ef\u3002 \u672c\u6559\u7a0b\u64cd\u4f5c\u7cfb\u7edf\uff1aLinux5.18.14\u7cfb\u7edf\u3001Dell G3\u7535\u8111\u3002 Python \u662f\u4e00\u79cd\u8de8\u5e73\u53f0\u7684\u7f16\u7a0b\u8bed\u8a00\uff0c\u53ef\u4ee5\u5728 Linux \u7cfb\u7edf\u4e0a\u8fd0\u884c\u3002\u4e8b\u5b9e\u4e0a\uff0cPython \u5728 Linux \u4e0a\u7684\u652f\u6301\u975e\u5e38\u5e7f\u6cdb\uff0c\u51e0\u4e4e\u6240\u6709\u7684 Linux \u53d1\u884c\u7248\u90fd\u5185\u7f6e\u4e86 Python \u89e3\u91ca\u5668\u3002 \u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u5728 Linux \u4e0a\u5b89\u88c5\u548c\u8fd0\u884c Python\uff1a 1\u3001\u68c0\u67e5\u7cfb\u7edf\u662f\u5426\u5df2\u7ecf\u5b89\u88c5 Python\uff1a \u7acb\u5373\u5b66\u4e60\u201c\u201d\uff1b \u6253\u5f00\u7ec8\u7aef\uff0c\u5e76\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u68c0\u67e5\u7cfb\u7edf\u662f\u5426\u5df2\u7ecf\u5b89\u88c5\u4e86 Python\uff1a &nbsp;&nbsp;python&nbsp;&#8211;version \u767b\u5f55\u540e\u590d\u5236 \u5982\u679c\u5df2\u7ecf\u5b89\u88c5\uff0c\u5219\u4f1a\u663e\u793a Python \u7684\u7248\u672c\u4fe1\u606f\u3002\u5982\u679c\u6ca1\u6709\u5b89\u88c5\uff0c\u5c06\u4f1a\u63d0\u793a\u627e\u4e0d\u5230\u547d\u4ee4\u3002 2\u3001\u5b89\u88c5 Python\uff1a \u5982\u679c\u7cfb\u7edf\u4e2d\u6ca1\u6709\u5b89\u88c5 Python\uff0c\u53ef\u4ee5\u4f7f\u7528\u5305\u7ba1\u7406\u5668\u6765\u5b89\u88c5\u3002 \u4f8b\u5982\uff1aCentOS\u3001RHEL \u7b49\u4f7f\u7528 yum \u5305\u7ba1\u7406\u5668\u7684\u53d1\u884c\u7248 &nbsp;sudo&nbsp;yum&nbsp;install&nbsp;python \u767b\u5f55\u540e\u590d\u5236 3\u3001\u9a8c\u8bc1\u5b89\u88c5\u7ed3\u679c\uff1a \u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u518d\u6b21\u6267\u884c&nbsp;python &#8211;version&nbsp;\u547d\u4ee4\u53ef\u4ee5\u786e\u8ba4 Python \u662f\u5426\u6210\u529f\u5b89\u88c5\uff0c\u5e76\u663e\u793a\u5176\u7248\u672c\u4fe1\u606f\u3002 4\u3001\u8fd0\u884c Python \u811a\u672c\uff1a \u5728\u7ec8\u7aef\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6765\u8fd0\u884c Python \u811a\u672c\u6587\u4ef6\uff1a &nbsp;&nbsp;python&nbsp;\/path\/to\/your_script.py \u767b\u5f55\u540e\u590d\u5236 \u5176\u4e2d&nbsp;\/path\/to\/your_script.py&nbsp;\u662f\u4f60\u7684 Python [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-16331","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/16331","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=16331"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/16331\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=16331"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=16331"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=16331"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}