{"id":948412,"date":"2024-12-27T00:03:23","date_gmt":"2024-12-26T16:03:23","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/948412.html"},"modified":"2024-12-27T00:03:25","modified_gmt":"2024-12-26T16:03:25","slug":"ubuntu-%e5%a6%82%e4%bd%95%e8%bf%90%e8%a1%8cpython","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/948412.html","title":{"rendered":"ubuntu \u5982\u4f55\u8fd0\u884cpython"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25083804\/adf6859a-8e41-4f7a-9d00-8812d8ffc05c.webp\" alt=\"ubuntu \u5982\u4f55\u8fd0\u884cpython\" \/><\/p>\n<p><p> <strong>\u5728Ubuntu\u4e0a\u8fd0\u884cPython\u53ef\u4ee5\u901a\u8fc7\u7ec8\u7aef\u3001Python\u4ea4\u4e92\u5f0f\u89e3\u91ca\u5668\u3001\u811a\u672c\u6587\u4ef6\u7b49\u591a\u79cd\u65b9\u5f0f\u5b8c\u6210\u3002\u786e\u4fddPython\u73af\u5883\u5df2\u5b89\u88c5\u3001\u4f7f\u7528\u7ec8\u7aef\u8f93\u5165Python\u547d\u4ee4\u3001\u521b\u5efaPython\u811a\u672c\u5e76\u6267\u884c\uff0c\u90fd\u662f\u5e38\u89c1\u7684\u65b9\u6cd5\u3002\u4ee5\u4e0b\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u5728Ubuntu\u4e2d\u8fdb\u884c\u8fd9\u4e9b\u64cd\u4f5c\u3002<\/strong><\/p>\n<\/p>\n<p><p>\u4e00\u3001\u786e\u4fddPython\u73af\u5883\u5df2\u5b89\u88c5<br \/>Ubuntu\u901a\u5e38\u9884\u88c5Python\uff0c\u4f46\u53ef\u4ee5\u901a\u8fc7\u7ec8\u7aef\u547d\u4ee4\u786e\u8ba4\u6216\u5b89\u88c5\u6700\u65b0\u7248\u672c\u3002\u9996\u5148\uff0c\u6253\u5f00\u7ec8\u7aef\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u6765\u68c0\u67e5\u5f53\u524d\u7cfb\u7edf\u4e2d\u5b89\u88c5\u7684Python\u7248\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python3 --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c\u7ec8\u7aef\u8fd4\u56dePython\u7248\u672c\u53f7\uff0c\u8bf4\u660ePython 3\u5df2\u7ecf\u5b89\u88c5\u3002\u5982\u679c\u6ca1\u6709\u5b89\u88c5\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u884c\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo apt update<\/p>\n<p>sudo apt install python3<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4e8c\u3001\u4f7f\u7528\u7ec8\u7aef\u8fd0\u884cPython\u4ea4\u4e92\u5f0f\u89e3\u91ca\u5668<br \/>Python\u4ea4\u4e92\u5f0f\u89e3\u91ca\u5668\u662f\u4e00\u4e2a\u65b9\u4fbf\u7684\u5de5\u5177\uff0c\u5141\u8bb8\u7528\u6237\u76f4\u63a5\u8f93\u5165Python\u4ee3\u7801\u5e76\u7acb\u5373\u770b\u5230\u7ed3\u679c\u3002\u5728Ubuntu\u4e2d\u542f\u52a8Python\u89e3\u91ca\u5668\u5f88\u7b80\u5355\uff0c\u53ea\u9700\u6253\u5f00\u7ec8\u7aef\u5e76\u8f93\u5165\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python3<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4f1a\u542f\u52a8Python 3\u7684\u4ea4\u4e92\u5f0f\u73af\u5883\uff0c\u60a8\u53ef\u4ee5\u5728\u5176\u4e2d\u8f93\u5165Python\u4ee3\u7801\u5e76\u67e5\u770b\u5373\u65f6\u8f93\u51fa\u3002\u4f8b\u5982\uff0c\u8f93\u5165<code>print(&quot;Hello, World!&quot;)<\/code>\uff0c\u6309\u4e0bEnter\u952e\uff0c\u60a8\u5c06\u770b\u5230\u8f93\u51fa\u7ed3\u679c\u3002<\/p>\n<\/p>\n<p><p>\u4e09\u3001\u521b\u5efa\u548c\u8fd0\u884cPython\u811a\u672c\u6587\u4ef6<br \/>\u5728Ubuntu\u4e0a\u8fd0\u884cPython\u811a\u672c\u6587\u4ef6\u662f\u5c06Python\u4ee3\u7801\u5b58\u50a8\u5728\u6587\u4ef6\u4e2d\u5e76\u6267\u884c\u7684\u8fc7\u7a0b\u3002\u4ee5\u4e0b\u662f\u5982\u4f55\u521b\u5efa\u548c\u8fd0\u884cPython\u811a\u672c\u6587\u4ef6\u7684\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u521b\u5efaPython\u811a\u672c\u6587\u4ef6<br \/>\u4f7f\u7528\u6587\u672c\u7f16\u8f91\u5668\uff08\u5982Nano\u3001Vim\u6216Gedit\uff09\u521b\u5efa\u4e00\u4e2aPython\u811a\u672c\u6587\u4ef6\u3002\u4f8b\u5982\uff0c\u4f7f\u7528Nano\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a<code>hello.py<\/code>\u7684\u6587\u4ef6\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-bash\">nano hello.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u6587\u4ef6\u4e2d\u8f93\u5165\u4ee5\u4e0b\u4ee3\u7801\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">print(&quot;Hello, World!&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4fdd\u5b58\u6587\u4ef6\u5e76\u9000\u51fa\u7f16\u8f91\u5668\u3002<\/p>\n<\/p>\n<ol start=\"2\">\n<li>\u8fd0\u884cPython\u811a\u672c\u6587\u4ef6<br \/>\u5728\u7ec8\u7aef\u4e2d\uff0c\u5bfc\u822a\u5230\u5305\u542bPython\u811a\u672c\u6587\u4ef6\u7684\u76ee\u5f55\uff0c\u5e76\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u6765\u8fd0\u884c\u811a\u672c\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-bash\">python3 hello.py<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u7ec8\u7aef\u5c06\u8f93\u51fa<code>Hello, World!<\/code>\uff0c\u8fd9\u8868\u660e\u60a8\u7684Python\u811a\u672c\u5df2\u6210\u529f\u8fd0\u884c\u3002<\/p>\n<\/p>\n<p><p>\u56db\u3001\u5b89\u88c5\u548c\u7ba1\u7406Python\u5305<br \/>\u5728\u4f7f\u7528Python\u8fdb\u884c\u5f00\u53d1\u65f6\uff0c\u60a8\u53ef\u80fd\u9700\u8981\u5b89\u88c5\u548c\u4f7f\u7528\u7b2c\u4e09\u65b9\u5e93\u3002Python\u7684\u5305\u7ba1\u7406\u5de5\u5177<code>pip<\/code>\u53ef\u4ee5\u5e2e\u52a9\u60a8\u5b89\u88c5\u548c\u7ba1\u7406\u8fd9\u4e9b\u5e93\u3002\u9996\u5148\uff0c\u786e\u4fdd<code>pip<\/code>\u5df2\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo apt install python3-pip<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6bd5\u540e\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528<code>pip<\/code>\u5b89\u88c5Python\u5e93\u3002\u4f8b\u5982\uff0c\u5b89\u88c5<code>requests<\/code>\u5e93\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip3 install requests<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6b64\u547d\u4ee4\u4f1a\u4e0b\u8f7d\u5e76\u5b89\u88c5<code>requests<\/code>\u5e93\uff0c\u60a8\u53ef\u4ee5\u5728Python\u811a\u672c\u4e2d\u5bfc\u5165\u5e76\u4f7f\u7528\u8be5\u5e93\u3002<\/p>\n<\/p>\n<p><p>\u4e94\u3001\u4f7f\u7528\u865a\u62df\u73af\u5883\u7ba1\u7406\u9879\u76ee\u4f9d\u8d56<br \/>\u5728\u5f00\u53d1\u591a\u4e2aPython\u9879\u76ee\u65f6\uff0c\u4f7f\u7528\u865a\u62df\u73af\u5883\u53ef\u4ee5\u5e2e\u52a9\u60a8\u9694\u79bb\u9879\u76ee\u4f9d\u8d56\uff0c\u907f\u514d\u5e93\u7248\u672c\u51b2\u7a81\u3002\u4ee5\u4e0b\u662f\u5982\u4f55\u5728Ubuntu\u4e2d\u521b\u5efa\u548c\u4f7f\u7528Python\u865a\u62df\u73af\u5883\u7684\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u5b89\u88c5<code>venv<\/code>\u6a21\u5757<br \/>\u9996\u5148\uff0c\u786e\u4fdd\u60a8\u7684\u7cfb\u7edf\u4e2d\u5b89\u88c5\u4e86<code>venv<\/code>\u6a21\u5757\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-bash\">sudo apt install python3-venv<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"2\">\n<li>\u521b\u5efa\u865a\u62df\u73af\u5883<br \/>\u5728\u60a8\u7684\u9879\u76ee\u76ee\u5f55\u4e2d\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u865a\u62df\u73af\u5883\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-bash\">python3 -m venv myenv<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4f1a\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a<code>myenv<\/code>\u7684\u865a\u62df\u73af\u5883\u76ee\u5f55\u3002<\/p>\n<\/p>\n<ol start=\"3\">\n<li>\u6fc0\u6d3b\u865a\u62df\u73af\u5883<br \/>\u5728\u7ec8\u7aef\u4e2d\uff0c\u5bfc\u822a\u5230\u5305\u542b\u865a\u62df\u73af\u5883\u7684\u76ee\u5f55\uff0c\u5e76\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u6fc0\u6d3b\u73af\u5883\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-bash\">source myenv\/bin\/activate<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6fc0\u6d3b\u540e\uff0c\u60a8\u5c06\u5728\u7ec8\u7aef\u63d0\u793a\u7b26\u4e2d\u770b\u5230\u73af\u5883\u540d\u79f0\uff0c\u4f8b\u5982<code>(myenv)<\/code>\uff0c\u8868\u660e\u865a\u62df\u73af\u5883\u5df2\u6fc0\u6d3b\u3002<\/p>\n<\/p>\n<ol start=\"4\">\n<li>\u5728\u865a\u62df\u73af\u5883\u4e2d\u5b89\u88c5\u5e93<br \/>\u5728\u6fc0\u6d3b\u7684\u865a\u62df\u73af\u5883\u4e2d\uff0c\u4f7f\u7528<code>pip<\/code>\u5b89\u88c5\u6240\u9700\u7684Python\u5e93\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-bash\">pip install requests<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4e9b\u5e93\u53ea\u4f1a\u5b89\u88c5\u5728\u865a\u62df\u73af\u5883\u4e2d\uff0c\u4e0d\u4f1a\u5f71\u54cd\u7cfb\u7edf\u8303\u56f4\u7684Python\u73af\u5883\u3002<\/p>\n<\/p>\n<ol start=\"5\">\n<li>\u9000\u51fa\u865a\u62df\u73af\u5883<br \/>\u5b8c\u6210\u5f00\u53d1\u540e\uff0c\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u9000\u51fa\u865a\u62df\u73af\u5883\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-bash\">deactivate<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u516d\u3001\u4f7f\u7528Jupyter Notebook\u8fdb\u884cPython\u5f00\u53d1<br \/>Jupyter Notebook\u662f\u4e00\u79cd\u4ea4\u4e92\u5f0f\u8ba1\u7b97\u73af\u5883\uff0c\u5141\u8bb8\u7528\u6237\u521b\u5efa\u548c\u5171\u4eab\u5305\u542b\u4ee3\u7801\u3001\u6570\u636e\u53ef\u89c6\u5316\u548c\u6ce8\u91ca\u7684\u6587\u6863\u3002\u4ee5\u4e0b\u662f\u5982\u4f55\u5728Ubuntu\u4e2d\u5b89\u88c5\u548c\u4f7f\u7528Jupyter Notebook\u7684\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u5b89\u88c5Jupyter Notebook<br \/>\u5728\u7ec8\u7aef\u4e2d\uff0c\u4f7f\u7528<code>pip<\/code>\u5b89\u88c5Jupyter Notebook\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-bash\">pip3 install jupyter<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"2\">\n<li>\u542f\u52a8Jupyter Notebook<br \/>\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u542f\u52a8Jupyter Notebook\uff1a<\/li>\n<\/ol>\n<p><pre><code class=\"language-bash\">jupyter notebook<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u4f1a\u5728\u60a8\u7684\u9ed8\u8ba4\u6d4f\u89c8\u5668\u4e2d\u6253\u5f00Jupyter Notebook\u754c\u9762\uff0c\u60a8\u53ef\u4ee5\u5728\u5176\u4e2d\u521b\u5efa\u548c\u7f16\u8f91Notebook\u3002<\/p>\n<\/p>\n<ol start=\"3\">\n<li>\u521b\u5efa\u548c\u8fd0\u884cNotebook<br \/>\u5728Jupyter Notebook\u754c\u9762\u4e2d\uff0c\u70b9\u51fb\u201cNew\u201d\u6309\u94ae\u5e76\u9009\u62e9\u201cPython 3\u201d\u4ee5\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Notebook\u3002\u5728Notebook\u4e2d\uff0c\u60a8\u53ef\u4ee5\u8f93\u5165Python\u4ee3\u7801\u5e76\u8fd0\u884c\u5b83\u4ee5\u67e5\u770b\u7ed3\u679c\u3002<\/li>\n<\/ol>\n<p><p>\u4e03\u3001\u4f7f\u7528IDE\u8fdb\u884cPython\u5f00\u53d1<br \/>\u5728Ubuntu\u4e0a\uff0c\u60a8\u53ef\u4ee5\u9009\u62e9\u591a\u79cd\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u6765\u8fdb\u884cPython\u5f00\u53d1\u3002\u5176\u4e2d\u4e00\u4e9b\u6d41\u884c\u7684\u9009\u62e9\u5305\u62ecPyCharm\u3001VS Code\u548cSpyder\u3002\u4ee5\u4e0b\u662f\u5982\u4f55\u5b89\u88c5\u548c\u4f7f\u7528\u8fd9\u4e9bIDE\u7684\u7b80\u5355\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p>\u5b89\u88c5PyCharm<br \/>PyCharm\u662f\u4e00\u4e2a\u529f\u80fd\u5f3a\u5927\u7684Python IDE\uff0c\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u5f00\u53d1\u5de5\u5177\u3002\u53ef\u4ee5\u901a\u8fc7Ubuntu\u8f6f\u4ef6\u4e2d\u5fc3\u6216\u76f4\u63a5\u4ecePyCharm\u7f51\u7ad9\u4e0b\u8f7d\u548c\u5b89\u88c5\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p>\u5b89\u88c5VS Code<br \/>Visual Studio Code\u662f\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u4f46\u529f\u80fd\u5f3a\u5927\u7684\u4ee3\u7801\u7f16\u8f91\u5668\uff0c\u652f\u6301Python\u5f00\u53d1\u3002\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><pre><code class=\"language-bash\">sudo snap install code --classic<\/p>\n<p><\/code><\/pre>\n<\/p>\n<ol start=\"3\">\n<li>\u914d\u7f6ePython\u5f00\u53d1\u73af\u5883<br \/>\u5728IDE\u4e2d\uff0c\u786e\u4fdd\u914d\u7f6ePython\u89e3\u91ca\u5668\u548c\u6240\u9700\u7684\u6269\u5c55\uff08\u5982Python\u63d2\u4ef6\uff09\uff0c\u4ee5\u4fbf\u83b7\u5f97\u6700\u4f73\u7684\u5f00\u53d1\u4f53\u9a8c\u3002<\/li>\n<\/ol>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u60a8\u5df2\u7ecf\u4e86\u89e3\u4e86\u5982\u4f55\u5728Ubuntu\u4e0a\u8fd0\u884cPython\u53ca\u5176\u76f8\u5173\u64cd\u4f5c\u3002\u65e0\u8bba\u662f\u4f7f\u7528\u7ec8\u7aef\u3001Python\u811a\u672c\u3001\u865a\u62df\u73af\u5883\uff0c\u8fd8\u662f\u501f\u52a9IDE\u548cJupyter Notebook\u8fdb\u884c\u5f00\u53d1\uff0cUbuntu\u63d0\u4f9b\u4e86\u591a\u79cd\u7075\u6d3b\u7684\u65b9\u6cd5\u6765\u6ee1\u8db3\u60a8\u7684Python\u5f00\u53d1\u9700\u6c42\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728Ubuntu\u4e2d\u5b89\u88c5Python\uff1f<\/strong><br \/>\u5728Ubuntu\u4e2d\uff0cPython\u901a\u5e38\u9884\u88c5\u5728\u7cfb\u7edf\u4e2d\uff0c\u4f46\u5982\u679c\u9700\u8981\u5b89\u88c5\u6700\u65b0\u7248\u672c\uff0c\u53ef\u4ee5\u4f7f\u7528\u547d\u4ee4\u884c\u3002\u6253\u5f00\u7ec8\u7aef\u5e76\u8f93\u5165<code>sudo apt update<\/code>\u66f4\u65b0\u8f6f\u4ef6\u5305\u5217\u8868\uff0c\u63a5\u7740\u4f7f\u7528<code>sudo apt install python3<\/code>\u6765\u5b89\u88c5Python 3\u7684\u6700\u65b0\u7248\u672c\u3002\u9a8c\u8bc1\u5b89\u88c5\u662f\u5426\u6210\u529f\uff0c\u53ef\u4ee5\u8f93\u5165<code>python3 --version<\/code>\u67e5\u770b\u5f53\u524d\u7248\u672c\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728Ubuntu\u4e2d\u8fd0\u884cPython\u811a\u672c\uff1f<\/strong><br \/>\u8fd0\u884cPython\u811a\u672c\u975e\u5e38\u7b80\u5355\u3002\u9996\u5148\uff0c\u786e\u4fdd\u4f60\u7684\u811a\u672c\u6587\u4ef6\u5177\u6709<code>.py<\/code>\u6269\u5c55\u540d\u3002\u6253\u5f00\u7ec8\u7aef\uff0c\u4f7f\u7528<code>cd<\/code>\u547d\u4ee4\u5bfc\u822a\u5230\u811a\u672c\u6240\u5728\u7684\u76ee\u5f55\u3002\u63a5\u7740\uff0c\u8f93\u5165<code>python3 script_name.py<\/code>\u6765\u8fd0\u884c\u811a\u672c\u3002\u8bb0\u5f97\u5c06<code>script_name.py<\/code>\u66ff\u6362\u4e3a\u4f60\u7684\u5b9e\u9645\u6587\u4ef6\u540d\u3002<\/p>\n<p><strong>\u5982\u4f55\u5728Ubuntu\u4e2d\u4f7f\u7528\u865a\u62df\u73af\u5883\u7ba1\u7406Python\u9879\u76ee\uff1f<\/strong><br \/>\u4f7f\u7528\u865a\u62df\u73af\u5883\u53ef\u4ee5\u5e2e\u52a9\u4f60\u7ba1\u7406\u4e0d\u540c\u9879\u76ee\u7684\u4f9d\u8d56\u5173\u7cfb\u3002\u5728Ubuntu\u4e2d\uff0c\u53ef\u4ee5\u4f7f\u7528<code>venv<\/code>\u6a21\u5757\u6765\u521b\u5efa\u865a\u62df\u73af\u5883\u3002\u9996\u5148\uff0c\u8f93\u5165<code>sudo apt install python3-venv<\/code>\u5b89\u88c5<code>venv<\/code>\u3002\u7136\u540e\uff0c\u8fdb\u5165\u4f60\u7684\u9879\u76ee\u76ee\u5f55\u5e76\u4f7f\u7528<code>python3 -m venv myenv<\/code>\u547d\u4ee4\u521b\u5efa\u4e00\u4e2a\u540d\u4e3a<code>myenv<\/code>\u7684\u865a\u62df\u73af\u5883\u3002\u6fc0\u6d3b\u865a\u62df\u73af\u5883\u53ef\u4ee5\u901a\u8fc7<code>source myenv\/bin\/activate<\/code>\u547d\u4ee4\u5b8c\u6210\uff0c\u6fc0\u6d3b\u540e\u5c31\u53ef\u4ee5\u5b89\u88c5\u6240\u9700\u7684\u5e93\u800c\u4e0d\u5f71\u54cd\u5168\u5c40Python\u73af\u5883\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5728Ubuntu\u4e0a\u8fd0\u884cPython\u53ef\u4ee5\u901a\u8fc7\u7ec8\u7aef\u3001Python\u4ea4\u4e92\u5f0f\u89e3\u91ca\u5668\u3001\u811a\u672c\u6587\u4ef6\u7b49\u591a\u79cd\u65b9\u5f0f\u5b8c\u6210\u3002\u786e\u4fddPytho [&hellip;]","protected":false},"author":3,"featured_media":948420,"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\/948412"}],"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=948412"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/948412\/revisions"}],"predecessor-version":[{"id":948423,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/948412\/revisions\/948423"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/948420"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=948412"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=948412"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=948412"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}