{"id":964507,"date":"2024-12-27T04:29:01","date_gmt":"2024-12-26T20:29:01","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/964507.html"},"modified":"2024-12-27T04:29:02","modified_gmt":"2024-12-26T20:29:02","slug":"%e5%a6%82%e4%bd%95%e7%9c%8b%e5%bd%93%e5%89%8dpython%e7%89%88%e6%9c%ac","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/964507.html","title":{"rendered":"\u5982\u4f55\u770b\u5f53\u524dpython\u7248\u672c"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24181253\/32d9d46e-7668-46e1-be98-a75fac74d9c5.webp\" alt=\"\u5982\u4f55\u770b\u5f53\u524dpython\u7248\u672c\" \/><\/p>\n<p><p> <strong>\u67e5\u770b\u5f53\u524dPython\u7248\u672c\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u67e5\u770b\u3001\u4f7f\u7528Python\u5185\u7f6e\u6a21\u5757\u67e5\u770b\u3001\u5728IDE\u4e2d\u67e5\u770b<\/strong>\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u5c06\u8be6\u7ec6\u63cf\u8ff0\u5982\u4f55\u901a\u8fc7\u547d\u4ee4\u884c\u67e5\u770bPython\u7248\u672c\u3002\u9996\u5148\uff0c\u6253\u5f00\u547d\u4ee4\u884c\uff08Windows\u4e0b\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4\u63d0\u793a\u7b26\uff0cmacOS\u548cLinux\u4e0b\u53ef\u4ee5\u4f7f\u7528\u7ec8\u7aef\uff09\uff0c\u8f93\u5165\u547d\u4ee4<code>python --version<\/code>\u6216<code>python -V<\/code>\uff0c\u5373\u53ef\u663e\u793a\u5f53\u524d\u5b89\u88c5\u7684Python\u7248\u672c\u53f7\u3002\u82e5\u5b89\u88c5\u4e86\u591a\u4e2aPython\u7248\u672c\uff0c\u53ef\u4ee5\u901a\u8fc7<code>python3 --version<\/code>\u6216<code>python3 -V<\/code>\u67e5\u770bPython3\u7684\u7248\u672c\u3002<\/p>\n<\/p>\n<hr>\n<p><p>\u4e00\u3001\u901a\u8fc7\u547d\u4ee4\u884c\u67e5\u770bPython\u7248\u672c<\/p>\n<\/p>\n<p><p>\u5728\u5b9e\u9645\u5f00\u53d1\u4e2d\uff0c\u7ecf\u5e38\u9700\u8981\u786e\u8ba4Python\u7684\u7248\u672c\uff0c\u786e\u4fdd\u4e0e\u9879\u76ee\u6240\u9700\u7684\u7248\u672c\u5339\u914d\u3002\u901a\u8fc7\u547d\u4ee4\u884c\u67e5\u770bPython\u7248\u672c\u662f\u4e00\u79cd\u5feb\u901f\u800c\u6709\u6548\u7684\u65b9\u6cd5\u3002<\/p>\n<\/p>\n<ol>\n<li><strong>Windows\u7cfb\u7edf<\/strong><\/li>\n<\/ol>\n<p><p>\u5728Windows\u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u63d0\u793a\u7b26\u6765\u67e5\u770bPython\u7684\u7248\u672c\u3002\u6309\u4e0b\u201cWin + R\u201d\u7ec4\u5408\u952e\uff0c\u8f93\u5165<code>cmd<\/code>\u5e76\u56de\u8f66\uff0c\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\u3002\u63a5\u7740\uff0c\u8f93\u5165<code>python --version<\/code>\u6216<code>python -V<\/code>\uff0c\u6309\u4e0b\u56de\u8f66\u952e\uff0c\u7cfb\u7edf\u5c06\u663e\u793a\u5f53\u524d\u5b89\u88c5\u7684Python\u7248\u672c\u53f7\u3002<\/p>\n<\/p>\n<p><p>\u5982\u679c\u7cfb\u7edf\u4e2d\u5b89\u88c5\u4e86\u591a\u4e2a\u7248\u672c\u7684Python\uff0c\u53ef\u80fd\u9700\u8981\u4f7f\u7528<code>python3 --version<\/code>\u6216<code>python3 -V<\/code>\u6765\u67e5\u770bPython3\u7684\u7248\u672c\u3002\u6b64\u5916\uff0c\u786e\u4fddPython\u7684\u8def\u5f84\u5df2\u6dfb\u52a0\u5230\u73af\u5883\u53d8\u91cf\u4e2d\uff0c\u4ee5\u4fbf\u547d\u4ee4\u63d0\u793a\u7b26\u80fd\u591f\u8bc6\u522bPython\u547d\u4ee4\u3002<\/p>\n<\/p>\n<ol start=\"2\">\n<li><strong>macOS\u7cfb\u7edf<\/strong><\/li>\n<\/ol>\n<p><p>\u5728macOS\u7cfb\u7edf\u4e2d\uff0c\u6253\u5f00\u201c\u7ec8\u7aef\u201d\u5e94\u7528\u7a0b\u5e8f\u3002\u9ed8\u8ba4\u60c5\u51b5\u4e0b\uff0cmacOS\u901a\u5e38\u4f1a\u9884\u5b89\u88c5Python\uff0c\u56e0\u6b64\u53ef\u4ee5\u76f4\u63a5\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165<code>python --version<\/code>\u6216<code>python -V<\/code>\u67e5\u770bPython\u7248\u672c\u3002\u5982\u679c\u5b89\u88c5\u4e86Python 3\uff0c\u4f7f\u7528<code>python3 --version<\/code>\u6216<code>python3 -V<\/code>\u67e5\u770b\u5176\u7248\u672c\u3002<\/p>\n<\/p>\n<p><p>\u503c\u5f97\u6ce8\u610f\u7684\u662f\uff0cmacOS\u81ea\u5e26\u7684Python\u7248\u672c\u53ef\u80fd\u8f83\u65e7\uff0c\u5efa\u8bae\u7528\u6237\u901a\u8fc7Homebrew\u7b49\u5305\u7ba1\u7406\u5de5\u5177\u5b89\u88c5\u6700\u65b0\u7248\u672c\u7684Python\u3002<\/p>\n<\/p>\n<ol start=\"3\">\n<li><strong>Linux\u7cfb\u7edf<\/strong><\/li>\n<\/ol>\n<p><p>\u5728Linux\u7cfb\u7edf\u4e2d\uff0c\u6253\u5f00\u7ec8\u7aef\u5e94\u7528\u7a0b\u5e8f\u3002\u4e0emacOS\u7c7b\u4f3c\uff0cLinux\u7cfb\u7edf\u901a\u5e38\u4e5f\u4f1a\u9884\u88c5Python\u3002\u53ef\u4ee5\u901a\u8fc7\u8f93\u5165<code>python --version<\/code>\u6216<code>python -V<\/code>\u67e5\u770bPython\u7248\u672c\uff0c\u6216\u4f7f\u7528<code>python3 --version<\/code>\u6216<code>python3 -V<\/code>\u67e5\u770bPython 3\u7684\u7248\u672c\u3002<\/p>\n<\/p>\n<p><p>\u5bf9\u4e8e\u4e0d\u540c\u7684Linux\u53d1\u884c\u7248\uff0cPython\u7684\u9ed8\u8ba4\u5b89\u88c5\u8def\u5f84\u53ef\u80fd\u4e0d\u540c\u3002\u5982\u679c\u4f7f\u7528\u7684\u662f\u7cfb\u7edf\u81ea\u5e26\u7684Python\u7248\u672c\uff0c\u53ef\u80fd\u9700\u8981\u7ba1\u7406\u5458\u6743\u9650\u8fdb\u884c\u66f4\u65b0\u3002<\/p>\n<\/p>\n<p><p>\u4e8c\u3001\u901a\u8fc7Python\u5185\u7f6e\u6a21\u5757\u67e5\u770b\u7248\u672c<\/p>\n<\/p>\n<p><p>\u9664\u4e86\u4f7f\u7528\u547d\u4ee4\u884c\u5916\uff0c\u8fd8\u53ef\u4ee5\u5728Python\u811a\u672c\u4e2d\u4f7f\u7528\u5185\u7f6e\u6a21\u5757\u67e5\u770bPython\u7248\u672c\u4fe1\u606f\u3002<\/p>\n<\/p>\n<ol>\n<li><strong>\u4f7f\u7528sys\u6a21\u5757<\/strong><\/li>\n<\/ol>\n<p><p>Python\u63d0\u4f9b\u4e86<code>sys<\/code>\u6a21\u5757\uff0c\u53ef\u4ee5\u5728Python\u811a\u672c\u4e2d\u83b7\u53d6Python\u7248\u672c\u4fe1\u606f\u3002\u901a\u8fc7<code>sys.version<\/code>\u6216<code>sys.version_info<\/code>\u53ef\u4ee5\u83b7\u53d6\u5230\u8be6\u7ec6\u7684\u7248\u672c\u4fe1\u606f\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import sys<\/p>\n<p>print(&quot;Python version&quot;)<\/p>\n<p>print(sys.version)<\/p>\n<p>print(&quot;Version info.&quot;)<\/p>\n<p>print(sys.version_info)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4e0a\u8ff0\u4ee3\u7801\u5c06\u8f93\u51fa\u5f53\u524dPython\u7684\u5b8c\u6574\u7248\u672c\u5b57\u7b26\u4e32\u548c\u7248\u672c\u4fe1\u606f\u7684\u8be6\u7ec6\u7ed3\u6784\uff0c\u5305\u62ec\u4e3b\u7248\u672c\u53f7\u3001\u526f\u7248\u672c\u53f7\u548c\u5fae\u7248\u672c\u53f7\u3002<\/p>\n<\/p>\n<ol start=\"2\">\n<li><strong>\u4f7f\u7528platform\u6a21\u5757<\/strong><\/li>\n<\/ol>\n<p><p><code>platform<\/code>\u6a21\u5757\u4e5f\u662f\u83b7\u53d6Python\u7248\u672c\u4fe1\u606f\u7684\u5e38\u7528\u6a21\u5757\u3002\u901a\u8fc7<code>platform.python_version()<\/code>\u53ef\u4ee5\u76f4\u63a5\u5f97\u5230Python\u7248\u672c\u53f7\u7684\u5b57\u7b26\u4e32\u5f62\u5f0f\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import platform<\/p>\n<p>print(&quot;Python version:&quot;, platform.python_version())<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u6bb5\u4ee3\u7801\u5c06\u8f93\u51faPython\u7684\u7248\u672c\u53f7\uff0c\u4f8b\u5982\u201c3.9.7\u201d\u3002<\/p>\n<\/p>\n<p><p>\u4e09\u3001\u5728IDE\u4e2d\u67e5\u770bPython\u7248\u672c<\/p>\n<\/p>\n<p><p>\u8bb8\u591a\u5f00\u53d1\u8005\u4f7f\u7528\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u8fdb\u884cPython\u7f16\u7a0b\uff0c\u5982PyCharm\u3001VSCode\u3001Spyder\u7b49\u3002\u8fd9\u4e9bIDE\u901a\u5e38\u63d0\u4f9b\u4e86\u67e5\u770b\u548c\u5207\u6362Python\u7248\u672c\u7684\u529f\u80fd\u3002<\/p>\n<\/p>\n<ol>\n<li><strong>PyCharm<\/strong><\/li>\n<\/ol>\n<p><p>\u5728PyCharm\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u201cFile\u201d -&gt; \u201cSettings\u201d -&gt; \u201cProject: [Project Name]\u201d -&gt; \u201cPython Interpreter\u201d\u67e5\u770b\u5f53\u524d\u9879\u76ee\u4f7f\u7528\u7684Python\u89e3\u91ca\u5668\u53ca\u5176\u7248\u672c\u3002\u5728\u6b64\u754c\u9762\u4e2d\uff0c\u8fd8\u53ef\u4ee5\u6dfb\u52a0\u6216\u79fb\u9664Python\u89e3\u91ca\u5668\u3002<\/p>\n<\/p>\n<ol start=\"2\">\n<li><strong>VSCode<\/strong><\/li>\n<\/ol>\n<p><p>\u5728VSCode\u4e2d\uff0c\u70b9\u51fb\u5de6\u4e0b\u89d2\u7684Python\u7248\u672c\u53f7\u6216\u6309\u4e0b\u201cCtrl + Shift + P\u201d\u6253\u5f00\u547d\u4ee4\u9762\u677f\uff0c\u8f93\u5165\u201cPython: Select Interpreter\u201d\u5e76\u9009\u62e9\u76f8\u5e94\u7684Python\u89e3\u91ca\u5668\uff0c\u5373\u53ef\u67e5\u770b\u548c\u5207\u6362Python\u7248\u672c\u3002<\/p>\n<\/p>\n<ol start=\"3\">\n<li><strong>\u5176\u4ed6IDE<\/strong><\/li>\n<\/ol>\n<p><p>\u7c7b\u4f3c\u5730\uff0c\u5176\u4ed6IDE\u901a\u5e38\u5728\u8bbe\u7f6e\u6216\u9879\u76ee\u914d\u7f6e\u4e2d\u63d0\u4f9b\u67e5\u770bPython\u7248\u672c\u7684\u9009\u9879\u3002\u7528\u6237\u53ef\u4ee5\u6839\u636e\u5177\u4f53IDE\u7684\u6587\u6863\u6216\u5e2e\u52a9\u4fe1\u606f\u627e\u5230\u76f8\u5173\u8bbe\u7f6e\u3002<\/p>\n<\/p>\n<p><p>\u56db\u3001\u786e\u4fddPython\u7248\u672c\u4e0e\u9879\u76ee\u9700\u6c42\u5339\u914d<\/p>\n<\/p>\n<p><p>\u5728\u5f00\u53d1\u8fc7\u7a0b\u4e2d\uff0c\u786e\u4fddPython\u7248\u672c\u4e0e\u9879\u76ee\u9700\u6c42\u5339\u914d\u975e\u5e38\u91cd\u8981\uff0c\u56e0\u4e3a\u4e0d\u540c\u7248\u672c\u7684Python\u53ef\u80fd\u5b58\u5728\u8bed\u6cd5\u548c\u5e93\u7684\u5dee\u5f02\u3002<\/p>\n<\/p>\n<ol>\n<li><strong>\u67e5\u770b\u9879\u76ee\u9700\u6c42<\/strong><\/li>\n<\/ol>\n<p><p>\u901a\u5e38\uff0c\u9879\u76ee\u7684\u4f9d\u8d56\u548cPython\u7248\u672c\u8981\u6c42\u4f1a\u5728<code>requirements.txt<\/code>\u6216<code>Pipfile<\/code>\u7b49\u6587\u4ef6\u4e2d\u6ce8\u660e\u3002\u5728\u5f00\u59cb\u4e00\u4e2a\u9879\u76ee\u4e4b\u524d\uff0c\u68c0\u67e5\u8fd9\u4e9b\u6587\u4ef6\u4e2d\u7684\u7248\u672c\u8981\u6c42\uff0c\u4ee5\u786e\u4fdd\u73af\u5883\u8bbe\u7f6e\u6b63\u786e\u3002<\/p>\n<\/p>\n<ol start=\"2\">\n<li><strong>\u4f7f\u7528\u865a\u62df\u73af\u5883<\/strong><\/li>\n<\/ol>\n<p><p>\u521b\u5efa\u865a\u62df\u73af\u5883\u53ef\u4ee5\u5e2e\u52a9\u5f00\u53d1\u8005\u5728\u540c\u4e00\u53f0\u8ba1\u7b97\u673a\u4e0a\u4f7f\u7528\u591a\u4e2aPython\u7248\u672c\uff0c\u5e76\u4e3a\u6bcf\u4e2a\u9879\u76ee\u9694\u79bb\u4f9d\u8d56\u3002\u4f7f\u7528<code>virtualenv<\/code>\u6216<code>venv<\/code>\u6a21\u5757\u53ef\u4ee5\u8f7b\u677e\u521b\u5efa\u865a\u62df\u73af\u5883\uff0c\u5e76\u5728\u5176\u4e2d\u5b89\u88c5\u6240\u9700\u7684Python\u7248\u672c\u548c\u4f9d\u8d56\u5e93\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\"># \u521b\u5efa\u865a\u62df\u73af\u5883<\/p>\n<p>python -m venv myenv<\/p>\n<h2><strong>\u6fc0\u6d3b\u865a\u62df\u73af\u5883\uff08Windows\uff09<\/strong><\/h2>\n<p>myenv\\Scripts\\activate<\/p>\n<h2><strong>\u6fc0\u6d3b\u865a\u62df\u73af\u5883\uff08macOS\/Linux\uff09<\/strong><\/h2>\n<p>source myenv\/bin\/activate<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u521b\u5efa\u5e76\u6fc0\u6d3b\u865a\u62df\u73af\u5883\u540e\uff0c\u53ef\u4ee5\u5728\u5176\u4e2d\u81ea\u7531\u5b89\u88c5\u548c\u4f7f\u7528\u4e0d\u540c\u7248\u672c\u7684\u5e93\uff0c\u800c\u4e0d\u4f1a\u5f71\u54cd\u5168\u5c40Python\u73af\u5883\u3002<\/p>\n<\/p>\n<p><p>\u4e94\u3001\u66f4\u65b0Python\u7248\u672c<\/p>\n<\/p>\n<p><p>\u968f\u7740Python\u7684\u4e0d\u65ad\u53d1\u5c55\uff0c\u65b0\u7248\u672c\u4f1a\u5e26\u6765\u6027\u80fd\u63d0\u5347\u3001\u529f\u80fd\u589e\u5f3a\u548c\u5b89\u5168\u4fee\u590d\u3002\u5f00\u53d1\u8005\u5e94\u5b9a\u671f\u66f4\u65b0Python\u7248\u672c\u4ee5\u4eab\u53d7\u8fd9\u4e9b\u6539\u8fdb\u3002<\/p>\n<\/p>\n<ol>\n<li><strong>\u4f7f\u7528\u5305\u7ba1\u7406\u5de5\u5177<\/strong><\/li>\n<\/ol>\n<p><p>\u5728macOS\u548cLinux\u4e0a\uff0c\u53ef\u4ee5\u4f7f\u7528\u5305\u7ba1\u7406\u5de5\u5177\u5982Homebrew\u6216apt-get\u6765\u66f4\u65b0Python\u7248\u672c\u3002\u4f8b\u5982\uff0c\u5728macOS\u4e0a\u4f7f\u7528Homebrew\u66f4\u65b0Python\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">brew update<\/p>\n<p>brew upgrade python<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728Ubuntu\u7b49Linux\u53d1\u884c\u7248\u4e0a\u4f7f\u7528apt-get\u66f4\u65b0Python\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo apt-get update<\/p>\n<p>sudo apt-get install python3<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"2\">\n<li><strong>\u4ecePython\u5b98\u7f51\u4e0b\u8f7d<\/strong><\/li>\n<\/ol>\n<p><p>\u5728Windows\u4e0a\uff0c\u5efa\u8bae\u4ecePython\u7684\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u6700\u65b0\u7248\u672c\u7684\u5b89\u88c5\u5305\u8fdb\u884c\u66f4\u65b0\u3002\u4e0b\u8f7d\u5b8c\u6210\u540e\uff0c\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f\uff0c\u6309\u7167\u63d0\u793a\u6b65\u9aa4\u8fdb\u884c\u66f4\u65b0\u3002<\/p>\n<\/p>\n<ol start=\"3\">\n<li><strong>\u6ce8\u610f\u517c\u5bb9\u6027<\/strong><\/li>\n<\/ol>\n<p><p>\u5728\u66f4\u65b0Python\u7248\u672c\u65f6\uff0c\u5e94\u6ce8\u610f\u68c0\u67e5\u9879\u76ee\u548c\u4f9d\u8d56\u5e93\u7684\u517c\u5bb9\u6027\u3002\u6709\u4e9b\u5e93\u53ef\u80fd\u9700\u8981\u7b49\u5f85\u4e00\u6bb5\u65f6\u95f4\u624d\u80fd\u652f\u6301\u6700\u65b0\u7248\u672c\u7684Python\uff0c\u56e0\u6b64\u5728\u66f4\u65b0\u524d\u6700\u597d\u9605\u8bfb\u76f8\u5173\u7684\u53d1\u884c\u8bf4\u660e\u548c\u6587\u6863\u3002<\/p>\n<\/p>\n<p><p>\u603b\u7ed3\uff1a\u4e86\u89e3\u5982\u4f55\u67e5\u770b\u5f53\u524dPython\u7248\u672c\u662fPython\u5f00\u53d1\u4e2d\u7684\u57fa\u672c\u6280\u80fd\uff0c\u8fd9\u6709\u52a9\u4e8e\u786e\u4fdd\u5f00\u53d1\u73af\u5883\u4e0e\u9879\u76ee\u9700\u6c42\u5339\u914d\u3002\u901a\u8fc7\u547d\u4ee4\u884c\u3001\u5185\u7f6e\u6a21\u5757\u6216IDE\u90fd\u53ef\u4ee5\u65b9\u4fbf\u5730\u67e5\u770bPython\u7248\u672c\u3002\u540c\u65f6\uff0c\u4f7f\u7528\u865a\u62df\u73af\u5883\u548c\u5b9a\u671f\u66f4\u65b0Python\u7248\u672c\u6709\u52a9\u4e8e\u7ef4\u62a4\u4e00\u4e2a\u9ad8\u6548\u3001\u5b89\u5168\u7684\u5f00\u53d1\u73af\u5883\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728\u547d\u4ee4\u884c\u4e2d\u68c0\u67e5Python\u7248\u672c\uff1f<\/strong><br \/>\u8981\u5728\u547d\u4ee4\u884c\u4e2d\u67e5\u770b\u5f53\u524d\u5b89\u88c5\u7684Python\u7248\u672c\uff0c\u60a8\u53ef\u4ee5\u6253\u5f00\u7ec8\u7aef\u6216\u547d\u4ee4\u63d0\u793a\u7b26\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<code>python --version<\/code> \u6216 <code>python3 --version<\/code>\u3002\u6267\u884c\u8be5\u547d\u4ee4\u540e\uff0c\u7cfb\u7edf\u4f1a\u8fd4\u56de\u5f53\u524d\u5b89\u88c5\u7684Python\u7248\u672c\u53f7\uff0c\u4f8b\u5982\u201cPython 3.8.10\u201d\u3002<\/p>\n<p><strong>\u5728Python\u811a\u672c\u4e2d\u5982\u4f55\u83b7\u53d6\u5f53\u524d\u7248\u672c\u4fe1\u606f\uff1f<\/strong><br \/>\u5728Python\u811a\u672c\u4e2d\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528<code>sys<\/code>\u6a21\u5757\u6765\u83b7\u53d6\u5f53\u524d\u7684Python\u7248\u672c\u4fe1\u606f\u3002\u53ea\u9700\u5728\u4ee3\u7801\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff1a  <\/p>\n<pre><code class=\"language-python\">import sys\nprint(sys.version)\n<\/code><\/pre>\n<p>\u8fd9\u6bb5\u4ee3\u7801\u4f1a\u8f93\u51faPython\u7684\u7248\u672c\u4fe1\u606f\uff0c\u5305\u62ec\u4e3b\u7248\u672c\u53f7\u3001\u6b21\u7248\u672c\u53f7\u4ee5\u53ca\u5176\u4ed6\u76f8\u5173\u4fe1\u606f\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728IDE\u4e2d\u67e5\u770bPython\u7248\u672c\uff1f<\/strong><br \/>\u5982\u679c\u60a8\u4f7f\u7528\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u5982PyCharm\u6216VS Code\uff0c\u53ef\u4ee5\u5728\u8bbe\u7f6e\u6216\u5173\u4e8e\u83dc\u5355\u4e2d\u627e\u5230Python\u7248\u672c\u3002\u5728PyCharm\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u5bfc\u822a\u5230\u201cFile\u201d &gt; \u201cSettings\u201d &gt; \u201cProject: [\u9879\u76ee\u540d\u79f0]\u201d\u6765\u67e5\u770b\u5f53\u524d\u9879\u76ee\u4f7f\u7528\u7684Python\u89e3\u91ca\u5668\u53ca\u5176\u7248\u672c\u3002\u5728VS Code\u4e2d\uff0c\u67e5\u770b\u5e95\u90e8\u72b6\u6001\u680f\uff0c\u9009\u62e9Python\u89e3\u91ca\u5668\u65f6\uff0c\u7cfb\u7edf\u4f1a\u663e\u793a\u5f53\u524d\u7684Python\u7248\u672c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u67e5\u770b\u5f53\u524dPython\u7248\u672c\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u67e5\u770b\u3001\u4f7f\u7528Python\u5185\u7f6e\u6a21\u5757\u67e5\u770b\u3001\u5728IDE\u4e2d\u67e5\u770b\u3002\u63a5\u4e0b\u6765\uff0c\u6211\u5c06\u8be6\u7ec6\u63cf\u8ff0 [&hellip;]","protected":false},"author":3,"featured_media":964508,"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\/964507"}],"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=964507"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/964507\/revisions"}],"predecessor-version":[{"id":964509,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/964507\/revisions\/964509"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/964508"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=964507"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=964507"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=964507"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}