{"id":264404,"date":"2023-03-24T08:17:59","date_gmt":"2023-03-24T00:17:59","guid":{"rendered":"https:\/\/gulass.cn\/?p=264404"},"modified":"2023-02-20T20:18:36","modified_gmt":"2023-02-20T12:18:36","slug":"python-on-windows","status":"publish","type":"post","link":"https:\/\/gulass.cn\/python-on-windows.html","title":{"rendered":"\u6f14\u793a\u4e0b\u5982\u4f55\u5728 Windows \u4e0a\u4e0b\u8f7d\u548c\u5b89\u88c5 Python"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u8fd9\u4e2a\u7b80\u5355\u7684\u6307\u5357\u6f14\u793a\u4e86\u5982\u4f55\u5728 Windows \u4e0a\u4e0b\u8f7d\u548c\u5b89\u88c5 Python\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n

\u8fd9\u7bc7\u6587\u7ae0\u662f\u7528\u6700\u65b0\u7684 Python 3.11 \u7a33\u5b9a\u7248\u6d4b\u8bd5\u7684\u3002<\/p>\n

\u5728\u5b66\u4e60\u5982\u4f55\u5728 Windows \u4e0a\u5b89\u88c5 Python \u4e4b\u524d\uff0c\u4f60\u53ef\u80fd\u60f3\u770b\u770b\u5982\u4f55\u5728 Linux \u53d1\u884c\u7248\uff08\u5982 Ubuntu\uff09\u4e0a\u8f7b\u677e\u5b89\u88c5 Python\u3002\u5982\u679c\u4f60\u6253\u7b97\u6210\u4e3a\u4e00\u540d\u5f00\u53d1\u8005\uff0c\u6700\u597d\u5728 Linux \u4e2d\u5c1d\u8bd5 Python\u3002\u90a3\u4e48\uff0c\u4f60\u53ef\u80fd\u60f3\u770b\u770b \u5982\u4f55\u5728 Windows \u4e4b\u5916\u5b89\u88c5 Linux\uff08\u5982 Ubuntu\uff09\u3002<\/p>\n

Python \u662f\u4e00\u79cd\u6d41\u884c\u7684\u901a\u7528\u7f16\u7a0b\u8bed\u8a00\uff0c\u5728\u8fc7\u53bb\u5341\u5e74\u4e2d\u6210\u4e3a\u5f00\u53d1\u8005\u7684\u9009\u62e9\u3002\u800c\u4e14\u5b83\u7684\u53d7\u6b22\u8fce\u7a0b\u5ea6\u4e0e\u65e5\u4ff1\u589e\u3002\u5b83\u88ab\u5e7f\u6cdb\u7528\u4e8e\u7f51\u7edc\u5f00\u53d1\u3001\u590d\u6742\u7cfb\u7edf\u3001\u6570\u636e\u79d1\u5b66\u3001\u673a\u5668\u5b66\u4e60\u548c\u6240\u6709\u79d1\u5b66\u9886\u57df\u3002<\/p>\n

\u4f60\u53ef\u80fd\u9047\u5230\u7684 Python \u6709\u4e24\u4e2a\u7248\u672c\u3002Python2 \u76ee\u524d\u5df2\u7ecf\u4e0d\u652f\u6301\u4e86\u3002\u800c Python3 \u7cfb\u5217\u662f\u6301\u7eed\u652f\u6301\u7684\u7248\u672c\u3002<\/p>\n

\u68c0\u67e5 Python \u662f\u5426\u5df2\u7ecf\u5b89\u88c5<\/strong><\/div>\n

\u5728 Windows \u4e0a\u5b89\u88c5\u5b83\u4e4b\u524d\uff0c\u4f60\u5e94\u8be5\u68c0\u67e5\u5b83\u662f\u5426\u5df2\u7ecf\u5b89\u88c5\u3002\u4e00\u822c\u6765\u8bf4\uff0c\u5b83\u5e94\u8be5\u6ca1\u6709\u5b89\u88c5\uff0c\u4e0d\u50cf\u5728 Ubuntu \uff08\u548c\u5176\u4ed6 Linux \u53d1\u884c\u7248\uff09\u4e2d\uff0cPython \u662f\u9884\u5148\u5b89\u88c5\u7684\u3002<\/p>\n

\u4ece\u5f00\u59cb\u83dc\u5355\u4e2d\uff0c\u6253\u5f00\u201c\u547d\u4ee4\u63d0\u793a\u7b26\u201d\u3002<\/p>\n

\u5e76\u8f93\u5165\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/p>\n

python --version<\/pre>\n

\u5982\u679c Python \u662f\u53ef\u7528\u7684\uff0c\u5b83\u5c06\u663e\u793a\u4e00\u4e2a\u5305\u542b\u7248\u672c\u7ec6\u8282\u7684\u4fe1\u606f\u3002<\/p>\n

\u4e0b\u8f7d\u5e76\u5b89\u88c5 Python<\/strong><\/div>\n

\u6253\u5f00\u4e0b\u9762\u7684 Python \u5b98\u65b9\u4e0b\u8f7d\u9875\u9762\u3002
\n\u4e0b\u8f7d Python<\/a>
\n\"\"
\n\u5982\u4f55\u627e\u5230\u8981\u5b89\u88c5\u7684 Python<\/p>\n

\u5728\u9876\u90e8\uff0c\u4f60\u5e94\u8be5\u770b\u5230\u5f53\u524d\u7684\u7a33\u5b9a\u7248\u672c\u3002\u70b9\u51fb\u4e0b\u8f7d\u94fe\u63a5\u3002\u5982\u679c\u4f60\u6b63\u5728\u5bfb\u627e\u4efb\u4f55\u7279\u5b9a\u7684\u7248\u672c\uff0c\u5728\u8fd9\u4e2a\u9875\u9762\u4e0a\u5411\u4e0b\u6eda\u52a8\uff0c\u5728 \u201cPython releases by version number:\u201d \u7684\u6807\u7b7e\u4e0b\u4e0b\u8f7d\u7279\u5b9a\u7684\u7248\u672c\u3002<\/p>\n

\u4e0b\u8f7d\u540e\uff0c\u8fdb\u5165\u4e0b\u8f7d\u6587\u4ef6\u5939\uff0c\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f\u3002<\/p>\n

\u6309\u7167\u5c4f\u5e55\u4e0a\u7684\u6307\u793a\u8fdb\u884c\u5b89\u88c5\u3002<\/p>\n

\"\"
\n\u5b89\u88c5 Python \u7b2c 1 \u6b65<\/p>\n

\"\"
\n\u5b89\u88c5 Python \u7b2c 2 \u6b65<\/p>\n

\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u9a8c\u8bc1 Python \u7684\u7248\u672c\u3002<\/p>\n

\u9a8c\u8bc1 Python \u7248\u672c<\/strong><\/div>\n

\u4ece\u5f00\u59cb\u83dc\u5355\uff0c\u6253\u5f00\u201c\u547d\u4ee4\u63d0\u793a\u7b26\u201d\uff0c\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u3002<\/p>\n

python --version<\/pre>\n

\"\"
\nWindows \u4e0a\u7684 Python \u7248\u672c<\/p>\n

\u4f60\u5e94\u8be5\u770b\u5230\u4f60\u7684\u7cfb\u7edf\u5f53\u524d\u5b89\u88c5\u7684 Python \u5305\u7684\u7248\u672c\u3002\u53e6\u5916\uff0c\u4f60\u4e5f\u53ef\u4ee5\u8fd0\u884c\u4e0b\u9762\u7684\u7a0b\u5e8f\u6765\u83b7\u5f97\u4e00\u4e2a Python \u4ea4\u4e92\u5f0f shell\u3002<\/p>\n

python<\/pre>\n

\u4f60\u53ef\u4ee5\u7528 CTRL+Z \u548c\u56de\u8f66\u952e\u9000\u51fa\u8fd9\u4e2a\u4ea4\u4e92\u754c\u9762\u3002<\/p>\n

\u68c0\u67e5 PATH \u53d8\u91cf<\/strong><\/div>\n

\u4f60\u5e94\u8be5\u68c0\u67e5\u7cfb\u7edf\u53d8\u91cf PATH\uff0c\u770b\u770b Python \u7684\u53ef\u6267\u884c\u4f4d\u7f6e\u662f\u5426\u5b58\u5728\u3002\u8fd9\u5e94\u8be5\u662f\u4f7f\u7528\u5b89\u88c5\u7a0b\u5e8f\u81ea\u52a8\u66f4\u65b0\u7684\u3002<\/p>\n

\u4ece\u5f00\u59cb\u83dc\u5355\u4e2d\uff0c\u641c\u7d22\u201c\u7cfb\u7edf\u53d8\u91cfsystem variables\u201d\u5e76\u6253\u5f00\u5b83\u3002
\n\"\"
\n\u6253\u5f00\u73af\u5883\u53d8\u91cf\u8bbe\u7f6e<\/p>\n

\u5728\u201c\u7cfb\u7edf\u5c5e\u6027\u201d\u5bf9\u8bdd\u6846\u4e2d\uff0c\u70b9\u51fb\u201c\u9ad8\u7ea7Advanced > \u73af\u5883\u53d8\u91cfEnvironment Variables\u201d\u3002\u5728\u7528\u6237\u53d8\u91cf\u90e8\u5206\uff0c\u5bf9\u7167\u8def\u5f84\u53d8\u91cf\uff0c\u68c0\u67e5 Python \u7684\u5b89\u88c5\u4f4d\u7f6e\u662f\u5426\u5b58\u5728\u3002\u8bf7\u53c2\u8003\u4e0b\u9762\u7684\u56fe\u7247\u4f5c\u4e3a\u6307\u5bfc\u3002<\/p>\n

\u5982\u679c\u4f60\u770b\u5230\u6240\u6709\u7684\u8def\u5f84\u90fd\u5b58\u5728\uff0c\u4f60\u5c31\u53ef\u4ee5\u8fd0\u884c\u4f60\u7684 Python \u9879\u76ee\u4e86\u3002
\n\"\"
\n\u68c0\u67e5 Windows \u4e2d\u7684 Python \u73af\u5883 PATH \u503c<\/p>\n

\u521b\u5efa\u5e76\u8fd0\u884c\u4f60\u7684\u7b2c\u4e00\u4e2a Python \u7a0b\u5e8f<\/strong><\/div>\n

\u4e00\u4e2a\u989d\u5916\u7684\u6b65\u9aa4\uff0c\u8fd9\u91cc\u662f\u4f60\u5982\u4f55\u7f16\u7801\u548c\u8fd0\u884c\u4f60\u7684\u7b2c\u4e00\u4e2a Python \u7a0b\u5e8f\u3002\u4f60\u53ef\u4ee5\u4f7f\u7528\u4efb\u610f \u63a8\u8350\u7684 Python \u7f16\u8f91\u5668 \u6765\u7f16\u5199\u4f60\u7684\u7a0b\u5e8f\u3002<\/p>\n

\u4e0b\u9762\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u7a0b\u5e8f\uff0c\u5b83\u5728\u63a7\u5236\u53f0\u4e2d\u8f93\u51fa\u6587\u672c debugpoint.com\u3002<\/p>\n

# Sample Python program\r\nprint(\"debugpoint.com\")<\/pre>\n

\u7528\u4efb\u610f\u540d\u5b57\u4fdd\u5b58\u6587\u4ef6\u3002\u8fd9\u91cc\u6211\u628a\u5b83\u4fdd\u5b58\u4e3a hello.py\uff0c\u653e\u5728 E \u76d8\u3002.py \u662f Python \u6e90\u7801\u7684\u6269\u5c55\u540d\u3002<\/p>\n

\u8981\u8fd0\u884c\u8fd9\u4e2a\u7a0b\u5e8f\uff0c\u8bf7\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff0c\u5728 E \u76d8\u4e2d\u6267\u884c\u4ee5\u4e0b\u5185\u5bb9\u3002<\/p>\n

python hello.py<\/pre>\n

\u8f93\u51fa\uff1a
\n\"\"
\n\u5728 Windows \u4e2d\u8fd0\u884c\u4e00\u4e2a\u7b80\u5355\u7684 Python \u7a0b\u5e8f<\/p>\n

\u7ed3\u675f\u8bed<\/strong><\/div>\n

\u6211\u5e0c\u671b\u8fd9\u4e2a\u7b80\u5355\u7684\u521d\u5b66\u8005\u6307\u5357\u80fd\u591f\u5e2e\u52a9\u4f60\u5728 Windows \u4e2d\u5b89\u88c5 Python\uff0c\u9a8c\u8bc1\u5b89\u88c5\u5e76\u8fd0\u884c\u4f60\u7684\u7b2c\u4e00\u4e2a\u7a0b\u5e8f\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

\u8fd9\u7bc7\u6587\u7ae0\u662f\u7528\u6700\u65b0\u7684 Python 3.11 \u7a33\u5b9a\u7248\u6d4b\u8bd5\u7684\u3002 \u5728\u5b66\u4e60\u5982\u4f55\u5728 Windows \u4e0a\u5b89\u88c5 Python […]<\/p>\n","protected":false},"author":321,"featured_media":264412,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-264404","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/264404","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/users\/321"}],"replies":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/comments?post=264404"}],"version-history":[{"count":3,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/264404\/revisions"}],"predecessor-version":[{"id":264415,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/posts\/264404\/revisions\/264415"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media\/264412"}],"wp:attachment":[{"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/media?parent=264404"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/categories?post=264404"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gulass.cn\/wp-json\/wp\/v2\/tags?post=264404"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}