{"id":1032439,"date":"2024-12-31T11:33:40","date_gmt":"2024-12-31T03:33:40","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1032439.html"},"modified":"2024-12-31T11:33:43","modified_gmt":"2024-12-31T03:33:43","slug":"%e5%a6%82%e4%bd%95%e6%9f%a5%e7%9c%8bpython%e6%98%af32%e8%bf%98%e6%98%af64%e4%bd%8d","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1032439.html","title":{"rendered":"\u5982\u4f55\u67e5\u770bpython\u662f32\u8fd8\u662f64\u4f4d"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-docs.pingcode.com\/wp-content\/uploads\/2024\/12\/897b0d45-9d9e-47eb-a5e7-2c1d64d10efc.webp?x-oss-process=image\/auto-orient,1\/format,webp\" alt=\"\u5982\u4f55\u67e5\u770bpython\u662f32\u8fd8\u662f64\u4f4d\" \/><\/p>\n<p><p> <strong>\u67e5\u770bPython\u662f32\u4f4d\u8fd8\u662f64\u4f4d\u7684\u5173\u952e\u6b65\u9aa4\u5305\u62ec\uff1a\u4f7f\u7528\u547d\u4ee4\u884c\u68c0\u67e5\u3001\u901a\u8fc7Python\u811a\u672c\u68c0\u67e5\u3001\u67e5\u770bPython\u5b89\u88c5\u8def\u5f84\u3001\u68c0\u67e5\u64cd\u4f5c\u7cfb\u7edf\u4fe1\u606f<\/strong>\u3002\u5176\u4e2d\uff0c\u901a\u8fc7Python\u811a\u672c\u68c0\u67e5\u662f\u6700\u4e3a\u76f4\u63a5\u548c\u5e38\u7528\u7684\u65b9\u6cd5\u3002\u4e0b\u9762\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u8fd9\u4e9b\u65b9\u6cd5\u7684\u5177\u4f53\u64cd\u4f5c\u6b65\u9aa4\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001\u901a\u8fc7\u547d\u4ee4\u884c\u68c0\u67e5<\/p>\n<\/p>\n<p><p>\u5728\u547d\u4ee4\u884c\u4e2d\u53ef\u4ee5\u4f7f\u7528\u7b80\u5355\u7684\u547d\u4ee4\u6765\u68c0\u67e5Python\u7684\u4f4d\u6570\u3002\u8fd9\u79cd\u65b9\u6cd5\u9002\u7528\u4e8e\u6240\u6709\u64cd\u4f5c\u7cfb\u7edf\uff0c\u5305\u62ecWindows\u3001Linux\u548cMacOS\u3002\u5177\u4f53\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u547d\u4ee4\u884c\uff08Windows\u4f7f\u7528cmd\uff0cLinux\u548cMacOS\u4f7f\u7528\u7ec8\u7aef\uff09\u3002<\/li>\n<li>\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u5e76\u6309\u56de\u8f66\uff1a\n<pre><code>python<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u5728Python\u89e3\u91ca\u5668\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a\n<pre><code class=\"language-python\">import struct<\/p>\n<p>print(struct.calcsize(&quot;P&quot;) * 8)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p>\u8fd9\u6761\u547d\u4ee4\u5c06\u8f93\u51faPython\u89e3\u91ca\u5668\u7684\u4f4d\u6570\uff0c32\u4f4dPython\u5c06\u8f93\u51fa32\uff0c64\u4f4dPython\u5c06\u8f93\u51fa64\u3002<\/li>\n<\/p>\n<\/ol>\n<p><p>\u8fd9\u79cd\u65b9\u6cd5\u7684\u4f18\u70b9\u662f\u5feb\u901f\u3001\u76f4\u63a5\uff0c\u4e0d\u9700\u8981\u7f16\u5199\u989d\u5916\u7684\u811a\u672c\u6216\u67e5\u627e\u5b89\u88c5\u8def\u5f84\u4fe1\u606f\u3002<\/p>\n<\/p>\n<p><p>\u4e8c\u3001\u901a\u8fc7Python\u811a\u672c\u68c0\u67e5<\/p>\n<\/p>\n<p><p>\u5982\u679c\u4f60\u66f4\u559c\u6b22\u4f7f\u7528Python\u811a\u672c\u6765\u68c0\u67e5Python\u7684\u4f4d\u6570\uff0c\u53ef\u4ee5\u7f16\u5199\u4e00\u4e2a\u7b80\u5355\u7684\u811a\u672c\u6765\u5b9e\u73b0\u8fd9\u4e00\u76ee\u7684\u3002\u5177\u4f53\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u4e00\u4e2a\u6587\u672c\u7f16\u8f91\u5668\uff08\u4f8b\u5982Notepad\u3001Sublime Text\u6216VSCode\uff09\u3002<\/li>\n<li>\u8f93\u5165\u4ee5\u4e0b\u4ee3\u7801\u5e76\u4fdd\u5b58\u4e3a\u4e00\u4e2aPython\u6587\u4ef6\uff0c\u4f8b\u5982check_python_bit.py\uff1a\n<pre><code class=\"language-python\">import struct<\/p>\n<p>print(&quot;Python is running in&quot;, struct.calcsize(&quot;P&quot;) * 8, &quot;bit mode&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u5728\u547d\u4ee4\u884c\u4e2d\u5bfc\u822a\u5230\u4fdd\u5b58\u811a\u672c\u7684\u76ee\u5f55\uff0c\u7136\u540e\u8fd0\u884c\u811a\u672c\uff1a\n<pre><code>python check_python_bit.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p>\u8fd9\u5c06\u8f93\u51faPython\u89e3\u91ca\u5668\u7684\u4f4d\u6570\u3002<\/li>\n<\/p>\n<\/ol>\n<p><p>\u8fd9\u79cd\u65b9\u6cd5\u9002\u7528\u4e8e\u9700\u8981\u591a\u6b21\u68c0\u67e5Python\u4f4d\u6570\u7684\u60c5\u51b5\uff0c\u56e0\u4e3a\u4f60\u53ef\u4ee5\u968f\u65f6\u8fd0\u884c\u811a\u672c\u6765\u83b7\u53d6\u4fe1\u606f\u3002<\/p>\n<\/p>\n<p><p>\u4e09\u3001\u67e5\u770bPython\u5b89\u88c5\u8def\u5f84<\/p>\n<\/p>\n<p><p>\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0cPython\u7684\u5b89\u88c5\u8def\u5f84\u4e2d\u53ef\u80fd\u5305\u542b\u4f4d\u6570\u4fe1\u606f\u3002\u5177\u4f53\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u547d\u4ee4\u884c\u5e76\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u4ee5\u67e5\u770bPython\u7684\u5b89\u88c5\u8def\u5f84\uff1a\n<pre><code>python -c &quot;import sys; print(sys.executable)&quot;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u68c0\u67e5\u8f93\u51fa\u8def\u5f84\u4e2d\u7684\u4fe1\u606f\u3002\u4f8b\u5982\uff0c\u5728Windows\u4e0a\uff0c32\u4f4dPython\u901a\u5e38\u5b89\u88c5\u5728<code>C:\\PythonXX-32<\/code>\u76ee\u5f55\u4e2d\uff0c\u800c64\u4f4dPython\u901a\u5e38\u5b89\u88c5\u5728<code>C:\\PythonXX-64<\/code>\u76ee\u5f55\u4e2d\u3002<\/li>\n<\/ol>\n<p><p>\u8fd9\u79cd\u65b9\u6cd5\u7684\u51c6\u786e\u6027\u53d6\u51b3\u4e8e\u5b89\u88c5\u8def\u5f84\u662f\u5426\u5305\u542b\u4f4d\u6570\u4fe1\u606f\uff0c\u4f46\u5b83\u53ef\u4ee5\u4f5c\u4e3a\u5176\u4ed6\u65b9\u6cd5\u7684\u8865\u5145\u3002<\/p>\n<\/p>\n<p><p>\u56db\u3001\u68c0\u67e5\u64cd\u4f5c\u7cfb\u7edf\u4fe1\u606f<\/p>\n<\/p>\n<p><p>\u6709\u65f6\uff0c\u64cd\u4f5c\u7cfb\u7edf\u7684\u4f4d\u6570\u4e5f\u53ef\u4ee5\u5e2e\u52a9\u5224\u65adPython\u7684\u4f4d\u6570\u3002\u5177\u4f53\u6b65\u9aa4\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u5728Windows\u4e0a\uff0c\u53f3\u952e\u70b9\u51fb\u201c\u6b64\u7535\u8111\u201d\u6216\u201c\u8ba1\u7b97\u673a\u201d\u56fe\u6807\uff0c\u9009\u62e9\u201c\u5c5e\u6027\u201d\u3002\u5728\u7cfb\u7edf\u4fe1\u606f\u9875\u9762\u4e2d\u53ef\u4ee5\u770b\u5230\u64cd\u4f5c\u7cfb\u7edf\u7684\u4f4d\u6570\u3002<\/li>\n<li>\u5728Linux\u4e0a\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u68c0\u67e5\u64cd\u4f5c\u7cfb\u7edf\u7684\u4f4d\u6570\uff1a\n<pre><code>uname -m<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p>\u5982\u679c\u8f93\u51fa\u4e3ax86_64\uff0c\u5219\u64cd\u4f5c\u7cfb\u7edf\u4e3a64\u4f4d\uff1b\u5982\u679c\u8f93\u51fa\u4e3ai686\u6216i386\uff0c\u5219\u64cd\u4f5c\u7cfb\u7edf\u4e3a32\u4f4d\u3002<\/li>\n<\/p>\n<li>\u5728MacOS\u4e0a\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u68c0\u67e5\u64cd\u4f5c\u7cfb\u7edf\u7684\u4f4d\u6570\uff1a\n<pre><code>uname -m<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p>\u540c\u6837\uff0cx86_64\u8868\u793a64\u4f4d\uff0ci386\u8868\u793a32\u4f4d\u3002<\/li>\n<\/p>\n<\/ol>\n<p><p><strong>\u603b\u7ed3<\/strong><\/p>\n<\/p>\n<p><p>\u901a\u8fc7\u547d\u4ee4\u884c\u68c0\u67e5\u3001\u901a\u8fc7Python\u811a\u672c\u68c0\u67e5\u3001\u67e5\u770bPython\u5b89\u88c5\u8def\u5f84\u3001\u68c0\u67e5\u64cd\u4f5c\u7cfb\u7edf\u4fe1\u606f\u90fd\u662f\u67e5\u770bPython\u4f4d\u6570\u7684\u6709\u6548\u65b9\u6cd5\u3002\u5bf9\u4e8e\u5927\u591a\u6570\u7528\u6237\uff0c\u901a\u8fc7Python\u811a\u672c\u68c0\u67e5\u662f\u6700\u4e3a\u76f4\u63a5\u548c\u5e38\u7528\u7684\u65b9\u6cd5\uff0c\u53ea\u9700\u51e0\u884c\u4ee3\u7801\u5373\u53ef\u83b7\u53d6Python\u89e3\u91ca\u5668\u7684\u4f4d\u6570\u4fe1\u606f\u3002\u65e0\u8bba\u4f60\u4f7f\u7528\u54ea\u79cd\u65b9\u6cd5\uff0c\u4e86\u89e3Python\u7684\u4f4d\u6570\u5bf9\u4e8e\u786e\u4fdd\u517c\u5bb9\u6027\u548c\u6027\u80fd\u4f18\u5316\u90fd\u975e\u5e38\u91cd\u8981\u3002<\/p>\n<\/p>\n<p><p>\u4e00\u3001\u901a\u8fc7\u547d\u4ee4\u884c\u68c0\u67e5<\/p>\n<\/p>\n<p><p>\u5728\u547d\u4ee4\u884c\u4e2d\u68c0\u67e5Python\u7684\u4f4d\u6570\u662f\u6700\u4e3a\u76f4\u63a5\u7684\u65b9\u6cd5\u4e4b\u4e00\u3002\u4ee5\u4e0b\u662f\u8be6\u7ec6\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u547d\u4ee4\u884c\uff08Windows\u4f7f\u7528cmd\uff0cLinux\u548cMacOS\u4f7f\u7528\u7ec8\u7aef\uff09\u3002<\/li>\n<li>\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u5e76\u6309\u56de\u8f66\uff1a\n<pre><code>python<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u5728Python\u89e3\u91ca\u5668\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a\n<pre><code class=\"language-python\">import struct<\/p>\n<p>print(struct.calcsize(&quot;P&quot;) * 8)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u8fd9\u5c06\u8f93\u51faPython\u89e3\u91ca\u5668\u7684\u4f4d\u6570\u3002\u4f8b\u5982\uff0c\u5982\u679c\u8f93\u51fa\u4e3a64\uff0c\u5219\u8868\u793a\u4f60\u6b63\u5728\u4f7f\u752864\u4f4d\u7684Python\u89e3\u91ca\u5668\u3002<\/p>\n<\/p>\n<p><p>\u8fd9\u79cd\u65b9\u6cd5\u7684\u4f18\u70b9\u662f\u5feb\u901f\u3001\u76f4\u63a5\uff0c\u4e0d\u9700\u8981\u7f16\u5199\u989d\u5916\u7684\u811a\u672c\u6216\u67e5\u627e\u5b89\u88c5\u8def\u5f84\u4fe1\u606f\u3002\u5b83\u9002\u7528\u4e8e\u6240\u6709\u64cd\u4f5c\u7cfb\u7edf\uff0c\u5e76\u4e14\u4e0d\u4f9d\u8d56\u4e8e\u5916\u90e8\u5de5\u5177\u3002<\/p>\n<\/p>\n<p><p>\u4e8c\u3001\u901a\u8fc7Python\u811a\u672c\u68c0\u67e5<\/p>\n<\/p>\n<p><p>\u5982\u679c\u4f60\u66f4\u559c\u6b22\u4f7f\u7528Python\u811a\u672c\u6765\u68c0\u67e5Python\u7684\u4f4d\u6570\uff0c\u53ef\u4ee5\u7f16\u5199\u4e00\u4e2a\u7b80\u5355\u7684\u811a\u672c\u6765\u5b9e\u73b0\u8fd9\u4e00\u76ee\u7684\u3002\u4ee5\u4e0b\u662f\u5177\u4f53\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u4e00\u4e2a\u6587\u672c\u7f16\u8f91\u5668\uff08\u4f8b\u5982Notepad\u3001Sublime Text\u6216VSCode\uff09\u3002<\/li>\n<li>\u8f93\u5165\u4ee5\u4e0b\u4ee3\u7801\u5e76\u4fdd\u5b58\u4e3a\u4e00\u4e2aPython\u6587\u4ef6\uff0c\u4f8b\u5982check_python_bit.py\uff1a\n<pre><code class=\"language-python\">import struct<\/p>\n<p>print(&quot;Python is running in&quot;, struct.calcsize(&quot;P&quot;) * 8, &quot;bit mode&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u5728\u547d\u4ee4\u884c\u4e2d\u5bfc\u822a\u5230\u4fdd\u5b58\u811a\u672c\u7684\u76ee\u5f55\uff0c\u7136\u540e\u8fd0\u884c\u811a\u672c\uff1a\n<pre><code>python check_python_bit.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u8fd9\u5c06\u8f93\u51faPython\u89e3\u91ca\u5668\u7684\u4f4d\u6570\u3002\u4f8b\u5982\uff0c\u5982\u679c\u8f93\u51fa\u4e3a\u201cPython is running in 64 bit mode\u201d\uff0c\u5219\u8868\u793a\u4f60\u6b63\u5728\u4f7f\u752864\u4f4d\u7684Python\u89e3\u91ca\u5668\u3002<\/p>\n<\/p>\n<p><p>\u8fd9\u79cd\u65b9\u6cd5\u9002\u7528\u4e8e\u9700\u8981\u591a\u6b21\u68c0\u67e5Python\u4f4d\u6570\u7684\u60c5\u51b5\uff0c\u56e0\u4e3a\u4f60\u53ef\u4ee5\u968f\u65f6\u8fd0\u884c\u811a\u672c\u6765\u83b7\u53d6\u4fe1\u606f\u3002\u6b64\u5916\uff0c\u8fd9\u79cd\u65b9\u6cd5\u4e5f\u9002\u7528\u4e8e\u9700\u8981\u5728\u4ee3\u7801\u4e2d\u52a8\u6001\u83b7\u53d6Python\u4f4d\u6570\u7684\u573a\u666f\u3002<\/p>\n<\/p>\n<p><p>\u4e09\u3001\u67e5\u770bPython\u5b89\u88c5\u8def\u5f84<\/p>\n<\/p>\n<p><p>\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0cPython\u7684\u5b89\u88c5\u8def\u5f84\u4e2d\u53ef\u80fd\u5305\u542b\u4f4d\u6570\u4fe1\u606f\u3002\u4ee5\u4e0b\u662f\u5177\u4f53\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u547d\u4ee4\u884c\u5e76\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u4ee5\u67e5\u770bPython\u7684\u5b89\u88c5\u8def\u5f84\uff1a\n<pre><code>python -c &quot;import sys; print(sys.executable)&quot;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u68c0\u67e5\u8f93\u51fa\u8def\u5f84\u4e2d\u7684\u4fe1\u606f\u3002\u4f8b\u5982\uff0c\u5728Windows\u4e0a\uff0c32\u4f4dPython\u901a\u5e38\u5b89\u88c5\u5728<code>C:\\PythonXX-32<\/code>\u76ee\u5f55\u4e2d\uff0c\u800c64\u4f4dPython\u901a\u5e38\u5b89\u88c5\u5728<code>C:\\PythonXX-64<\/code>\u76ee\u5f55\u4e2d\u3002<\/li>\n<\/ol>\n<p><p>\u8fd9\u79cd\u65b9\u6cd5\u7684\u51c6\u786e\u6027\u53d6\u51b3\u4e8e\u5b89\u88c5\u8def\u5f84\u662f\u5426\u5305\u542b\u4f4d\u6570\u4fe1\u606f\uff0c\u4f46\u5b83\u53ef\u4ee5\u4f5c\u4e3a\u5176\u4ed6\u65b9\u6cd5\u7684\u8865\u5145\u3002\u5982\u679c\u5b89\u88c5\u8def\u5f84\u4e2d\u786e\u5b9e\u5305\u542b\u4f4d\u6570\u4fe1\u606f\uff0c\u8fd9\u5c06\u662f\u4e00\u4e2a\u975e\u5e38\u65b9\u4fbf\u7684\u65b9\u6cd5\u3002<\/p>\n<\/p>\n<p><p>\u56db\u3001\u68c0\u67e5\u64cd\u4f5c\u7cfb\u7edf\u4fe1\u606f<\/p>\n<\/p>\n<p><p>\u6709\u65f6\uff0c\u64cd\u4f5c\u7cfb\u7edf\u7684\u4f4d\u6570\u4e5f\u53ef\u4ee5\u5e2e\u52a9\u5224\u65adPython\u7684\u4f4d\u6570\u3002\u4ee5\u4e0b\u662f\u5177\u4f53\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u5728Windows\u4e0a\uff0c\u53f3\u952e\u70b9\u51fb\u201c\u6b64\u7535\u8111\u201d\u6216\u201c\u8ba1\u7b97\u673a\u201d\u56fe\u6807\uff0c\u9009\u62e9\u201c\u5c5e\u6027\u201d\u3002\u5728\u7cfb\u7edf\u4fe1\u606f\u9875\u9762\u4e2d\u53ef\u4ee5\u770b\u5230\u64cd\u4f5c\u7cfb\u7edf\u7684\u4f4d\u6570\u3002<\/li>\n<li>\u5728Linux\u4e0a\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u68c0\u67e5\u64cd\u4f5c\u7cfb\u7edf\u7684\u4f4d\u6570\uff1a\n<pre><code>uname -m<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p>\u5982\u679c\u8f93\u51fa\u4e3ax86_64\uff0c\u5219\u64cd\u4f5c\u7cfb\u7edf\u4e3a64\u4f4d\uff1b\u5982\u679c\u8f93\u51fa\u4e3ai686\u6216i386\uff0c\u5219\u64cd\u4f5c\u7cfb\u7edf\u4e3a32\u4f4d\u3002<\/li>\n<\/p>\n<li>\u5728MacOS\u4e0a\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u68c0\u67e5\u64cd\u4f5c\u7cfb\u7edf\u7684\u4f4d\u6570\uff1a\n<pre><code>uname -m<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p>\u540c\u6837\uff0cx86_64\u8868\u793a64\u4f4d\uff0ci386\u8868\u793a32\u4f4d\u3002<\/li>\n<\/p>\n<\/ol>\n<p><p>\u867d\u7136\u64cd\u4f5c\u7cfb\u7edf\u7684\u4f4d\u6570\u4e0d\u4e00\u5b9a\u76f4\u63a5\u51b3\u5b9aPython\u7684\u4f4d\u6570\uff0c\u4f46\u901a\u5e38\u572864\u4f4d\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u5b89\u88c564\u4f4dPython\u7684\u6982\u7387\u8f83\u5927\u3002<\/p>\n<\/p>\n<p><p>\u4e94\u3001\u7ed3\u5408\u591a\u79cd\u65b9\u6cd5\u8fdb\u884c\u9a8c\u8bc1<\/p>\n<\/p>\n<p><p>\u4e3a\u4e86\u786e\u4fdd\u68c0\u67e5\u7ed3\u679c\u7684\u51c6\u786e\u6027\uff0c\u53ef\u4ee5\u7ed3\u5408\u591a\u79cd\u65b9\u6cd5\u8fdb\u884c\u9a8c\u8bc1\u3002\u4ee5\u4e0b\u662f\u5177\u4f53\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u9996\u5148\uff0c\u5728\u547d\u4ee4\u884c\u4e2d\u68c0\u67e5Python\u7684\u4f4d\u6570\uff1a\n<pre><code class=\"language-python\">import struct<\/p>\n<p>print(struct.calcsize(&quot;P&quot;) * 8)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u63a5\u7740\uff0c\u901a\u8fc7\u8fd0\u884cPython\u811a\u672c\u6765\u518d\u6b21\u786e\u8ba4\uff1a\n<pre><code class=\"language-python\">import struct<\/p>\n<p>print(&quot;Python is running in&quot;, struct.calcsize(&quot;P&quot;) * 8, &quot;bit mode&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\u6700\u540e\uff0c\u67e5\u770bPython\u7684\u5b89\u88c5\u8def\u5f84\uff0c\u9a8c\u8bc1\u662f\u5426\u5305\u542b\u4f4d\u6570\u4fe1\u606f\uff1a\n<pre><code>python -c &quot;import sys; print(sys.executable)&quot;<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u901a\u8fc7\u4e0a\u8ff0\u65b9\u6cd5\u7684\u7efc\u5408\u8fd0\u7528\uff0c\u53ef\u4ee5\u66f4\u51c6\u786e\u5730\u5224\u65adPython\u7684\u4f4d\u6570\u3002\u7279\u522b\u662f\u5728\u67d0\u4e9b\u7279\u6b8a\u573a\u666f\u4e0b\uff0c\u4f8b\u5982\u9700\u8981\u786e\u8ba4Python\u73af\u5883\u7684\u517c\u5bb9\u6027\u65f6\uff0c\u7efc\u5408\u591a\u79cd\u65b9\u6cd5\u8fdb\u884c\u9a8c\u8bc1\u663e\u5f97\u5c24\u4e3a\u91cd\u8981\u3002<\/p>\n<\/p>\n<p><p>\u516d\u3001\u4f7f\u7528\u7b2c\u4e09\u65b9\u5de5\u5177<\/p>\n<\/p>\n<p><p>\u6709\u4e00\u4e9b\u7b2c\u4e09\u65b9\u5de5\u5177\u4e5f\u53ef\u4ee5\u5e2e\u52a9\u68c0\u67e5Python\u7684\u4f4d\u6570\u3002\u8fd9\u4e9b\u5de5\u5177\u901a\u5e38\u63d0\u4f9b\u56fe\u5f62\u754c\u9762\uff0c\u64cd\u4f5c\u66f4\u52a0\u7b80\u4fbf\u3002\u4ee5\u4e0b\u662f\u51e0\u4e2a\u5e38\u7528\u5de5\u5177\uff1a<\/p>\n<\/p>\n<ol>\n<li><strong>Anaconda Navigator<\/strong>\uff1aAnaconda\u662f\u4e00\u6b3e\u6d41\u884c\u7684Python\u6570\u636e\u79d1\u5b66\u5e73\u53f0\u3002\u901a\u8fc7Anaconda Navigator\uff0c\u4f60\u53ef\u4ee5\u8f7b\u677e\u67e5\u770b\u548c\u7ba1\u7406Python\u73af\u5883\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u5305\u62ecPython\u7684\u4f4d\u6570\u3002<\/li>\n<li><strong>PyCharm<\/strong>\uff1aPyCharm\u662fJetBr<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>ns\u516c\u53f8\u5f00\u53d1\u7684\u4e00\u6b3ePython\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u3002\u5728PyCharm\u4e2d\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6e\u754c\u9762\u67e5\u770bPython\u89e3\u91ca\u5668\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u5305\u62ec\u4f4d\u6570\u3002<\/li>\n<li><strong>Visual Studio Code<\/strong>\uff1aVisual Studio Code\u662f\u5fae\u8f6f\u516c\u53f8\u5f00\u53d1\u7684\u4e00\u6b3e\u514d\u8d39\u5f00\u6e90\u7684\u4ee3\u7801\u7f16\u8f91\u5668\u3002\u901a\u8fc7\u5b89\u88c5Python\u6269\u5c55\uff0c\u4f60\u53ef\u4ee5\u5728VSCode\u4e2d\u67e5\u770bPython\u89e3\u91ca\u5668\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u5305\u62ec\u4f4d\u6570\u3002<\/li>\n<\/ol>\n<p><p>\u4f7f\u7528\u8fd9\u4e9b\u5de5\u5177\u7684\u4f18\u70b9\u662f\u64cd\u4f5c\u7b80\u4fbf\uff0c\u9002\u5408\u4e0d\u719f\u6089\u547d\u4ee4\u884c\u64cd\u4f5c\u7684\u7528\u6237\u3002\u6b64\u5916\uff0c\u8fd9\u4e9b\u5de5\u5177\u901a\u5e38\u8fd8\u63d0\u4f9b\u5176\u4ed6\u6709\u7528\u7684\u529f\u80fd\uff0c\u4f8b\u5982\u5305\u7ba1\u7406\u3001\u73af\u5883\u914d\u7f6e\u7b49\u3002<\/p>\n<\/p>\n<p><p>\u4e03\u3001Python\u7248\u672c\u4e0e\u4f4d\u6570\u5173\u7cfb<\/p>\n<\/p>\n<p><p>Python\u7684\u4e0d\u540c\u7248\u672c\u572832\u4f4d\u548c64\u4f4d\u4e0a\u7684\u8868\u73b0\u53ef\u80fd\u6709\u6240\u4e0d\u540c\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u9700\u8981\u6ce8\u610f\u7684\u4e8b\u9879\uff1a<\/p>\n<\/p>\n<ol>\n<li><strong>\u6027\u80fd\u5dee\u5f02<\/strong>\uff1a64\u4f4dPython\u901a\u5e38\u5728\u5904\u7406\u5927\u6570\u636e\u96c6\u548c\u8fdb\u884c\u9ad8\u6027\u80fd\u8ba1\u7b97\u65f6\u8868\u73b0\u66f4\u597d\uff0c\u56e0\u4e3a\u5b83\u53ef\u4ee5\u8bbf\u95ee\u66f4\u591a\u7684\u5185\u5b58\u3002\u7136\u800c\uff0c\u5bf9\u4e8e\u4e00\u4e9b\u5c0f\u578b\u5e94\u7528\uff0c32\u4f4dPython\u7684\u6027\u80fd\u53ef\u80fd\u66f4\u597d\uff0c\u56e0\u4e3a\u5b83\u7684\u5185\u5b58\u5360\u7528\u8f83\u5c0f\u3002<\/li>\n<li><strong>\u517c\u5bb9\u6027\u95ee\u9898<\/strong>\uff1a\u4e00\u4e9b\u65e7\u7684Python\u5e93\u548c\u6269\u5c55\u53ef\u80fd\u53ea\u652f\u630132\u4f4dPython\u3002\u5982\u679c\u4f60\u9700\u8981\u4f7f\u7528\u8fd9\u4e9b\u5e93\uff0c\u53ef\u80fd\u9700\u8981\u5b89\u88c532\u4f4d\u7684Python\u3002<\/li>\n<li><strong>\u5b89\u88c5\u5305<\/strong>\uff1a\u5728\u5b89\u88c5Python\u65f6\uff0c\u4f60\u901a\u5e38\u53ef\u4ee5\u9009\u62e9\u5b89\u88c532\u4f4d\u621664\u4f4d\u7684\u7248\u672c\u3002\u786e\u4fdd\u9009\u62e9\u4e0e\u4f60\u7684\u64cd\u4f5c\u7cfb\u7edf\u548c\u5e94\u7528\u9700\u6c42\u76f8\u5339\u914d\u7684\u7248\u672c\u3002<\/li>\n<\/ol>\n<p><p>\u4e86\u89e3\u8fd9\u4e9b\u5dee\u5f02\u53ef\u4ee5\u5e2e\u52a9\u4f60\u5728\u9009\u62e9Python\u7248\u672c\u65f6\u505a\u51fa\u66f4\u660e\u667a\u7684\u51b3\u7b56\u3002<\/p>\n<\/p>\n<p><p>\u516b\u3001\u5e38\u89c1\u95ee\u9898\u4e0e\u89e3\u51b3\u65b9\u6848<\/p>\n<\/p>\n<p><p>\u5728\u68c0\u67e5Python\u4f4d\u6570\u65f6\uff0c\u53ef\u80fd\u4f1a\u9047\u5230\u4e00\u4e9b\u5e38\u89c1\u95ee\u9898\u3002\u4ee5\u4e0b\u662f\u51e0\u4e2a\u5178\u578b\u95ee\u9898\u53ca\u5176\u89e3\u51b3\u65b9\u6848\uff1a<\/p>\n<\/p>\n<ol>\n<li><strong>\u547d\u4ee4\u884c\u65e0\u6cd5\u8bc6\u522b<code>python<\/code>\u547d\u4ee4<\/strong>\uff1a\u8fd9\u53ef\u80fd\u662f\u56e0\u4e3aPython\u6ca1\u6709\u6b63\u786e\u6dfb\u52a0\u5230\u7cfb\u7edf\u8def\u5f84\u4e2d\u3002\u4f60\u53ef\u4ee5\u5c1d\u8bd5\u4f7f\u7528<code>python3<\/code>\u547d\u4ee4\uff0c\u6216\u624b\u52a8\u5c06Python\u6dfb\u52a0\u5230\u7cfb\u7edf\u8def\u5f84\u4e2d\u3002<\/li>\n<li><strong>Python\u811a\u672c\u8fd0\u884c\u9519\u8bef<\/strong>\uff1a\u786e\u4fdd\u4f60\u4fdd\u5b58\u7684\u811a\u672c\u6587\u4ef6\u6269\u5c55\u540d\u4e3a<code>.py<\/code>\uff0c\u5e76\u4e14\u4f7f\u7528\u6b63\u786e\u7684\u547d\u4ee4\u8fd0\u884c\u811a\u672c\u3002<\/li>\n<li><strong>\u5b89\u88c5\u8def\u5f84\u4e2d\u6ca1\u6709\u4f4d\u6570\u4fe1\u606f<\/strong>\uff1a\u5982\u679c\u5b89\u88c5\u8def\u5f84\u4e2d\u6ca1\u6709\u4f4d\u6570\u4fe1\u606f\uff0c\u53ef\u4ee5\u7ed3\u5408\u5176\u4ed6\u65b9\u6cd5\uff08\u5982\u547d\u4ee4\u884c\u68c0\u67e5\u6216Python\u811a\u672c\uff09\u6765\u786e\u8ba4Python\u7684\u4f4d\u6570\u3002<\/li>\n<\/ol>\n<p><p>\u901a\u8fc7\u4e86\u89e3\u8fd9\u4e9b\u5e38\u89c1\u95ee\u9898\u53ca\u5176\u89e3\u51b3\u65b9\u6848\uff0c\u4f60\u53ef\u4ee5\u66f4\u987a\u5229\u5730\u5b8c\u6210Python\u4f4d\u6570\u7684\u68c0\u67e5\u3002<\/p>\n<\/p>\n<p><p>\u4e5d\u3001\u603b\u7ed3<\/p>\n<\/p>\n<p><p>\u67e5\u770bPython\u662f32\u4f4d\u8fd8\u662f64\u4f4d\u7684\u65b9\u6cd5\u6709\u591a\u79cd\uff0c\u5305\u62ec\u901a\u8fc7\u547d\u4ee4\u884c\u68c0\u67e5\u3001\u901a\u8fc7Python\u811a\u672c\u68c0\u67e5\u3001\u67e5\u770bPython\u5b89\u88c5\u8def\u5f84\u3001\u68c0\u67e5\u64cd\u4f5c\u7cfb\u7edf\u4fe1\u606f\u7b49\u3002\u7efc\u5408\u8fd0\u7528\u8fd9\u4e9b\u65b9\u6cd5\uff0c\u53ef\u4ee5\u66f4\u51c6\u786e\u5730\u5224\u65adPython\u7684\u4f4d\u6570\u3002\u65e0\u8bba\u662f\u4e3a\u4e86\u786e\u4fdd\u517c\u5bb9\u6027\uff0c\u8fd8\u662f\u4e3a\u4e86\u4f18\u5316\u6027\u80fd\uff0c\u4e86\u89e3Python\u7684\u4f4d\u6570\u90fd\u662f\u975e\u5e38\u91cd\u8981\u7684\u4e00\u6b65\u3002\u5e0c\u671b\u672c\u6587\u63d0\u4f9b\u7684\u8be6\u7ec6\u6b65\u9aa4\u548c\u7ecf\u9a8c\u89c1\u89e3\u80fd\u5e2e\u52a9\u4f60\u66f4\u597d\u5730\u5b8c\u6210\u8fd9\u4e00\u4efb\u52a1\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u68c0\u67e5\u6211\u5b89\u88c5\u7684Python\u7248\u672c\u662f32\u4f4d\u8fd8\u662f64\u4f4d\uff1f<\/strong><br \/>\u53ef\u4ee5\u901a\u8fc7\u5728\u547d\u4ee4\u884c\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u6765\u68c0\u67e5Python\u7684\u4f4d\u6570\uff1a<code>python<\/code> \u6216 <code>python3<\/code>\uff0c\u7136\u540e\u8f93\u5165<code>import platform<\/code>\u548c<code>platform.architecture()<\/code>\u3002\u8fd9\u5c06\u8fd4\u56de\u4e00\u4e2a\u5305\u542b\u4f4d\u6570\u7684\u4fe1\u606f\uff0c\u4f8b\u5982<code>(&#39;64bit&#39;, &#39;WindowsPE&#39;)<\/code>\u3002\u6839\u636e\u8fd4\u56de\u7684\u7ed3\u679c\uff0c\u60a8\u53ef\u4ee5\u5224\u65ad\u662f32\u4f4d\u8fd8\u662f64\u4f4d\u3002<\/p>\n<p><strong>\u5728Windows\u7cfb\u7edf\u4e2d\uff0c\u6211\u8be5\u5982\u4f55\u67e5\u770bPython\u7684\u4f4d\u6570\uff1f<\/strong><br \/>\u5728Windows\u4e2d\uff0c\u60a8\u53ef\u4ee5\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff08CMD\uff09\uff0c\u8f93\u5165<code>python<\/code>\uff0c\u7136\u540e\u6309Enter\u952e\u3002\u5982\u679c\u60a8\u4f7f\u7528\u7684\u662f64\u4f4d\u7248\u672c\uff0c\u60a8\u4f1a\u770b\u5230\u7c7b\u4f3c\u4e8e<code>Windows-64<\/code>\u7684\u8f93\u51fa\u3002\u5982\u679c\u662f32\u4f4d\u7248\u672c\uff0c\u5219\u4f1a\u663e\u793a<code>Windows-32<\/code>\u3002<\/p>\n<p><strong>Mac\u6216Linux\u7528\u6237\u5982\u4f55\u786e\u8ba4Python\u662f32\u4f4d\u8fd8\u662f64\u4f4d\uff1f<\/strong><br \/>\u5728Mac\u6216Linux\u7cfb\u7edf\u4e2d\uff0c\u60a8\u53ef\u4ee5\u6253\u5f00\u7ec8\u7aef\uff0c\u8f93\u5165<code>python<\/code>\u6216<code>python3<\/code>\uff0c\u63a5\u7740\u8f93\u5165<code>import platform<\/code>\u548c<code>platform.architecture()<\/code>\u3002\u8fd9\u5c06\u663e\u793aPython\u7684\u4f4d\u6570\u4fe1\u606f\uff0c\u60a8\u53ef\u4ee5\u6839\u636e\u8f93\u51fa\u8fdb\u884c\u5224\u65ad\u3002\u6216\u8005\uff0c\u60a8\u4e5f\u53ef\u4ee5\u76f4\u63a5\u67e5\u770bPython\u7684\u53ef\u6267\u884c\u6587\u4ef6\u8def\u5f84\uff0c\u901a\u5e38\u4f4d\u4e8e<code>\/usr\/bin\/python<\/code>\uff0c\u7136\u540e\u4f7f\u7528<code>file<\/code>\u547d\u4ee4\u8fdb\u884c\u68c0\u67e5\uff0c\u4f8b\u5982<code>file \/usr\/bin\/python<\/code>\uff0c\u5b83\u4f1a\u663e\u793a\u8be5\u7248\u672c\u662f32\u4f4d\u8fd8\u662f64\u4f4d\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u67e5\u770bPython\u662f32\u4f4d\u8fd8\u662f64\u4f4d\u7684\u5173\u952e\u6b65\u9aa4\u5305\u62ec\uff1a\u4f7f\u7528\u547d\u4ee4\u884c\u68c0\u67e5\u3001\u901a\u8fc7Python\u811a\u672c\u68c0\u67e5\u3001\u67e5\u770bPython\u5b89 [&hellip;]","protected":false},"author":3,"featured_media":1032448,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1032439"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=1032439"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1032439\/revisions"}],"predecessor-version":[{"id":1032451,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1032439\/revisions\/1032451"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1032448"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1032439"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1032439"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1032439"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}