{"id":965211,"date":"2024-12-27T04:35:48","date_gmt":"2024-12-26T20:35:48","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/965211.html"},"modified":"2024-12-27T04:35:50","modified_gmt":"2024-12-26T20:35:50","slug":"%e5%a6%82%e4%bd%95%e8%87%aa%e5%b7%b1%e5%ae%89%e8%a3%85python%e5%ba%93","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/965211.html","title":{"rendered":"\u5982\u4f55\u81ea\u5df1\u5b89\u88c5python\u5e93"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24181618\/c33b22ab-ab15-4ecc-8291-81ee9eef4e15.webp\" alt=\"\u5982\u4f55\u81ea\u5df1\u5b89\u88c5python\u5e93\" \/><\/p>\n<p><h3>\u5982\u4f55\u81ea\u5df1\u5b89\u88c5Python\u5e93<\/h3>\n<\/p>\n<p><p><strong>\u5b89\u88c5Python\u5e93\u7684\u6b65\u9aa4\u5305\u62ec\uff1a\u68c0\u67e5Python\u548cpip\u7684\u5b89\u88c5\u3001\u4f7f\u7528pip\u547d\u4ee4\u5b89\u88c5\u5e93\u3001\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u3001\u5904\u7406\u4f9d\u8d56\u5173\u7cfb<\/strong>\u3002\u9996\u5148\uff0c\u786e\u4fdd\u4f60\u7684\u7cfb\u7edf\u4e0a\u5df2\u7ecf\u5b89\u88c5\u4e86Python\u548cpip\uff0c\u8fd9\u4e24\u4e2a\u5de5\u5177\u662f\u5b89\u88c5Python\u5e93\u7684\u5173\u952e\u3002<strong>\u68c0\u67e5\u5b89\u88c5<\/strong>\u662f\u5341\u5206\u91cd\u8981\u7684\uff0c\u56e0\u4e3a\u6ca1\u6709\u6b63\u786e\u5b89\u88c5Python\u548cpip\uff0c\u540e\u7eed\u7684\u6b65\u9aa4\u90fd\u65e0\u6cd5\u8fdb\u884c\u3002\u4ee5\u4e0b\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u5982\u4f55\u81ea\u5df1\u5b89\u88c5Python\u5e93\u7684\u6bcf\u4e00\u4e2a\u6b65\u9aa4\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u68c0\u67e5Python\u548cpip\u7684\u5b89\u88c5<\/h3>\n<\/p>\n<p><p>\u5728\u5b89\u88c5Python\u5e93\u4e4b\u524d\uff0c\u4f60\u9700\u8981\u786e\u4fdd\u4f60\u7684\u8ba1\u7b97\u673a\u4e0a\u5df2\u6b63\u786e\u5b89\u88c5\u4e86Python\u548cpip\u3002Python\u662f\u4e00\u79cd\u5e7f\u6cdb\u4f7f\u7528\u7684\u7f16\u7a0b\u8bed\u8a00\uff0c\u800cpip\u662fPython\u7684\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u7528\u4e8e\u5b89\u88c5\u548c\u7ba1\u7406Python\u5305\u3002<\/p>\n<\/p>\n<p><h4>1. \u68c0\u67e5Python\u7684\u5b89\u88c5<\/h4>\n<\/p>\n<p><p>\u5728\u547d\u4ee4\u884c\u6216\u7ec8\u7aef\u4e2d\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff0c\u6765\u67e5\u770bPython\u662f\u5426\u5df2\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6216<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python3 --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c\u770b\u5230\u7c7b\u4f3c\u4e8e<code>Python 3.x.x<\/code>\u7684\u8f93\u51fa\uff0c\u8bf4\u660ePython\u5df2\u6b63\u786e\u5b89\u88c5\u3002\u5426\u5219\uff0c\u4f60\u9700\u8981\u4ecePython\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u5e76\u5b89\u88c5Python\u3002<\/p>\n<\/p>\n<p><h4>2. \u68c0\u67e5pip\u7684\u5b89\u88c5<\/h4>\n<\/p>\n<p><p>\u540c\u6837\u5730\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770bpip\u662f\u5426\u5df2\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6216<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip3 --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5982\u679c\u770b\u5230\u7c7b\u4f3c\u4e8e<code>pip x.x.x from ...<\/code>\u7684\u8f93\u51fa\uff0c\u8bf4\u660epip\u5df2\u6b63\u786e\u5b89\u88c5\u3002\u82e5\u672a\u5b89\u88c5\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u8fdb\u884c\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python -m ensurepip --upgrade<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e8c\u3001\u4f7f\u7528pip\u547d\u4ee4\u5b89\u88c5\u5e93<\/h3>\n<\/p>\n<p><p>\u4e00\u65e6\u786e\u8ba4Python\u548cpip\u5df2\u6b63\u786e\u5b89\u88c5\uff0c\u4f60\u5c31\u53ef\u4ee5\u5f00\u59cb\u4f7f\u7528pip\u6765\u5b89\u88c5Python\u5e93\u4e86\u3002pip\u662f\u6700\u5e38\u7528\u7684Python\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u80fd\u591f\u5e2e\u52a9\u4f60\u8f7b\u677e\u5730\u5b89\u88c5\u3001\u66f4\u65b0\u3001\u5378\u8f7dPython\u5305\u3002<\/p>\n<\/p>\n<p><h4>1. \u5b89\u88c5Python\u5e93<\/h4>\n<\/p>\n<p><p>\u8981\u5b89\u88c5\u67d0\u4e2aPython\u5e93\uff0c\u53ea\u9700\u5728\u547d\u4ee4\u884c\u6216\u7ec8\u7aef\u4e2d\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install \u5e93\u540d<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4f8b\u5982\uff0c\u8981\u5b89\u88c5<code>requests<\/code>\u5e93\uff0c\u4f60\u9700\u8981\u8f93\u5165\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install requests<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u4ecePython\u5305\u7d22\u5f15\uff08PyPI\uff09\u4e0b\u8f7d\u5e76\u5b89\u88c5<code>requests<\/code>\u5e93\u3002<\/p>\n<\/p>\n<p><h4>2. \u5b89\u88c5\u7279\u5b9a\u7248\u672c\u7684\u5e93<\/h4>\n<\/p>\n<p><p>\u6709\u65f6\u4f60\u53ef\u80fd\u9700\u8981\u5b89\u88c5\u7279\u5b9a\u7248\u672c\u7684Python\u5e93\uff0c\u53ef\u4ee5\u901a\u8fc7\u6307\u5b9a\u7248\u672c\u53f7\u6765\u5b9e\u73b0\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install \u5e93\u540d==\u7248\u672c\u53f7<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u4f8b\u5982\uff0c\u8981\u5b89\u88c5<code>requests<\/code>\u5e93\u76842.25.1\u7248\u672c\uff0c\u4f60\u9700\u8981\u8f93\u5165\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install requests==2.25.1<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e09\u3001\u914d\u7f6e\u73af\u5883\u53d8\u91cf<\/h3>\n<\/p>\n<p><p>\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u5c24\u5176\u662f\u5728Windows\u7cfb\u7edf\u4e0a\uff0c\u6b63\u786e\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u662f\u786e\u4fddPython\u548cpip\u80fd\u591f\u6b63\u5e38\u8fd0\u884c\u7684\u91cd\u8981\u6b65\u9aa4\u3002<\/p>\n<\/p>\n<p><h4>1. \u914d\u7f6ePython\u73af\u5883\u53d8\u91cf<\/h4>\n<\/p>\n<p><p>\u5c06Python\u7684\u5b89\u88c5\u8def\u5f84\u6dfb\u52a0\u5230\u7cfb\u7edf\u7684\u73af\u5883\u53d8\u91cf\u4e2d\uff0c\u786e\u4fdd\u5728\u4efb\u610f\u76ee\u5f55\u4e0b\u90fd\u53ef\u4ee5\u8bbf\u95eePython\u547d\u4ee4\u3002<\/p>\n<\/p>\n<ol>\n<li>\u53f3\u952e\u70b9\u51fb\u201c\u6b64\u7535\u8111\u201d\u6216\u201c\u6211\u7684\u7535\u8111\u201d\uff0c\u9009\u62e9\u201c\u5c5e\u6027\u201d\u3002<\/li>\n<li>\u9009\u62e9\u201c\u9ad8\u7ea7\u7cfb\u7edf\u8bbe\u7f6e\u201d\u3002<\/li>\n<li>\u70b9\u51fb\u201c\u73af\u5883\u53d8\u91cf\u201d\u3002<\/li>\n<li>\u5728\u201c\u7cfb\u7edf\u53d8\u91cf\u201d\u4e2d\u627e\u5230\u201cPath\u201d\u53d8\u91cf\uff0c\u70b9\u51fb\u201c\u7f16\u8f91\u201d\u3002<\/li>\n<li>\u5c06Python\u7684\u5b89\u88c5\u8def\u5f84\uff08\u5982<code>C:\\Python39<\/code>\uff09\u6dfb\u52a0\u5230\u201cPath\u201d\u53d8\u91cf\u4e2d\u3002<\/li>\n<\/ol>\n<p><h4>2. \u914d\u7f6epip\u73af\u5883\u53d8\u91cf<\/h4>\n<\/p>\n<p><p>\u4e0ePython\u7c7b\u4f3c\uff0c\u4f60\u4e5f\u9700\u8981\u5c06pip\u7684\u8def\u5f84\u6dfb\u52a0\u5230\u73af\u5883\u53d8\u91cf\u4e2d\u3002\u901a\u5e38\uff0cpip\u5b89\u88c5\u5728Python\u7684Scripts\u76ee\u5f55\u4e0b\uff0c\u5982<code>C:\\Python39\\Scripts<\/code>\u3002<\/p>\n<\/p>\n<p><h3>\u56db\u3001\u5904\u7406\u4f9d\u8d56\u5173\u7cfb<\/h3>\n<\/p>\n<p><p>\u8bb8\u591aPython\u5e93\u4f9d\u8d56\u4e8e\u5176\u4ed6\u5e93\uff0c\u56e0\u6b64\u5728\u5b89\u88c5\u5e93\u65f6\uff0cpip\u4f1a\u81ea\u52a8\u5904\u7406\u8fd9\u4e9b\u4f9d\u8d56\u5173\u7cfb\u3002\u7136\u800c\uff0c\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u53ef\u80fd\u9700\u8981\u624b\u52a8\u7ba1\u7406\u4f9d\u8d56\u3002<\/p>\n<\/p>\n<p><h4>1. \u67e5\u770b\u5df2\u5b89\u88c5\u5e93\u53ca\u5176\u7248\u672c<\/h4>\n<\/p>\n<p><p>\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770b\u7cfb\u7edf\u4e0a\u5df2\u5b89\u88c5\u7684\u5e93\u53ca\u5176\u7248\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip list<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u8f93\u51fa\u6240\u6709\u5df2\u5b89\u88c5\u7684\u5e93\u53ca\u5176\u7248\u672c\u53f7\u3002<\/p>\n<\/p>\n<p><h4>2. \u89e3\u51b3\u4f9d\u8d56\u51b2\u7a81<\/h4>\n<\/p>\n<p><p>\u5728\u5b89\u88c5\u65b0\u5e93\u65f6\uff0c\u53ef\u80fd\u4f1a\u9047\u5230\u4f9d\u8d56\u51b2\u7a81\u7684\u60c5\u51b5\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0c\u4f60\u53ef\u4ee5\u5c1d\u8bd5\u4ee5\u4e0b\u65b9\u6cd5\uff1a<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u5347\u7ea7pip<\/strong>\uff1a\u9996\u5148\u786e\u4fddpip\u662f\u6700\u65b0\u7248\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install --upgrade pip<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6307\u5b9a\u7248\u672c<\/strong>\uff1a\u5982\u679c\u67d0\u4e2a\u5e93\u4e0e\u5176\u4ed6\u5e93\u7684\u7248\u672c\u51b2\u7a81\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u5b89\u88c5\u517c\u5bb9\u7248\u672c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install \u5e93\u540d==\u517c\u5bb9\u7248\u672c\u53f7<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4f7f\u7528\u865a\u62df\u73af\u5883<\/strong>\uff1a\u901a\u8fc7\u521b\u5efa\u865a\u62df\u73af\u5883\u6765\u9694\u79bb\u4e0d\u540c\u9879\u76ee\u7684\u4f9d\u8d56\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python -m venv myenv<\/p>\n<p>source myenv\/bin\/activate  # \u5728Linux\u6216MacOS\u4e0a<\/p>\n<p>myenv\\Scripts\\activate  # \u5728Windows\u4e0a<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728\u865a\u62df\u73af\u5883\u4e2d\uff0c\u4f60\u53ef\u4ee5\u5b89\u88c5\u7279\u5b9a\u7248\u672c\u7684\u5e93\uff0c\u800c\u4e0d\u4f1a\u5f71\u54cd\u5168\u5c40\u73af\u5883\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><h3>\u4e94\u3001\u4f7f\u7528Python\u5305\u7ba1\u7406\u5de5\u5177<\/h3>\n<\/p>\n<p><p>\u9664\u4e86pip\u4e4b\u5916\uff0c\u8fd8\u6709\u5176\u4ed6\u5de5\u5177\u53ef\u4ee5\u5e2e\u52a9\u4f60\u7ba1\u7406Python\u5e93\uff0c\u4f8b\u5982Anaconda\u3001Poetry\u548cpipenv\u3002<\/p>\n<\/p>\n<p><h4>1. Anaconda<\/h4>\n<\/p>\n<p><p>Anaconda\u662f\u4e00\u6b3e\u7528\u4e8e\u79d1\u5b66\u8ba1\u7b97\u7684Python\u53d1\u884c\u7248\uff0c\u9884\u88c5\u4e86\u8bb8\u591a\u5e38\u7528\u7684\u79d1\u5b66\u8ba1\u7b97\u5e93\u3002\u5b83\u6709\u81ea\u5df1\u7684\u5305\u7ba1\u7406\u5de5\u5177conda\uff0c\u53ef\u4ee5\u7528\u4e8e\u5b89\u88c5\u548c\u7ba1\u7406Python\u5e93\u3002<\/p>\n<\/p>\n<p><p>\u8981\u4f7f\u7528conda\u5b89\u88c5\u5e93\uff0c\u4f60\u53ef\u4ee5\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">conda install \u5e93\u540d<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. Poetry<\/h4>\n<\/p>\n<p><p>Poetry\u662f\u4e00\u6b3e\u73b0\u4ee3\u7684Python\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u53ef\u4ee5\u5e2e\u52a9\u4f60\u7ba1\u7406\u9879\u76ee\u4f9d\u8d56\u548c\u865a\u62df\u73af\u5883\u3002\u8981\u4f7f\u7528Poetry\u5b89\u88c5\u5e93\uff0c\u53ef\u4ee5\u8fd0\u884c\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">poetry add \u5e93\u540d<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>Poetry\u4f1a\u81ea\u52a8\u66f4\u65b0\u9879\u76ee\u7684\u4f9d\u8d56\u6587\u4ef6\uff08pyproject.toml\uff09\u3002<\/p>\n<\/p>\n<p><h4>3. pipenv<\/h4>\n<\/p>\n<p><p>pipenv\u662f\u53e6\u4e00\u4e2a\u6d41\u884c\u7684Python\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u5b83\u7ed3\u5408\u4e86pip\u548cvirtualenv\u7684\u529f\u80fd\u3002\u4f7f\u7528pipenv\u5b89\u88c5\u5e93\u7684\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pipenv install \u5e93\u540d<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>pipenv\u4f1a\u521b\u5efa\u4e00\u4e2a\u865a\u62df\u73af\u5883\uff0c\u5e76\u5b89\u88c5\u6307\u5b9a\u7684\u5e93\u3002<\/p>\n<\/p>\n<p><h3>\u516d\u3001\u5e38\u89c1\u95ee\u9898\u53ca\u89e3\u51b3\u65b9\u6848<\/h3>\n<\/p>\n<p><p>\u5728\u5b89\u88c5Python\u5e93\u65f6\uff0c\u4f60\u53ef\u80fd\u4f1a\u9047\u5230\u4e00\u4e9b\u5e38\u89c1\u95ee\u9898\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u89c1\u95ee\u9898\u53ca\u5176\u89e3\u51b3\u65b9\u6848\u3002<\/p>\n<\/p>\n<p><h4>1. \u8fde\u63a5\u8d85\u65f6\u6216\u4e0b\u8f7d\u5931\u8d25<\/h4>\n<\/p>\n<p><p>\u6709\u65f6\u7f51\u7edc\u95ee\u9898\u4f1a\u5bfc\u81f4\u5e93\u4e0b\u8f7d\u5931\u8d25\u3002\u53ef\u4ee5\u5c1d\u8bd5\u4f7f\u7528\u56fd\u5185\u955c\u50cf\u6e90\u63d0\u9ad8\u4e0b\u8f7d\u901f\u5ea6\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install \u5e93\u540d -i https:\/\/pypi.tuna.tsinghua.edu.cn\/simple<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u6743\u9650\u95ee\u9898<\/h4>\n<\/p>\n<p><p>\u5728\u67d0\u4e9b\u7cfb\u7edf\u4e0a\uff0c\u53ef\u80fd\u9700\u8981\u7ba1\u7406\u5458\u6743\u9650\u624d\u80fd\u5b89\u88c5\u5e93\u3002\u53ef\u4ee5\u901a\u8fc7\u5728\u547d\u4ee4\u524d\u52a0\u4e0a<code>sudo<\/code>\u6765\u63d0\u5347\u6743\u9650\uff08\u4ec5\u9002\u7528\u4e8eLinux\u548cMacOS\uff09\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">sudo pip install \u5e93\u540d<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5728Windows\u4e0a\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u4ee5\u7ba1\u7406\u5458\u8eab\u4efd\u8fd0\u884c\u547d\u4ee4\u63d0\u793a\u7b26\u3002<\/p>\n<\/p>\n<p><h4>3. \u7248\u672c\u51b2\u7a81<\/h4>\n<\/p>\n<p><p>\u5982\u679c\u9047\u5230\u7248\u672c\u51b2\u7a81\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u4f7f\u7528\u865a\u62df\u73af\u5883\u6216\u6307\u5b9a\u7248\u672c\u6765\u89e3\u51b3\u51b2\u7a81\u3002<\/p>\n<\/p>\n<p><p>\u901a\u8fc7\u8fd9\u4e9b\u6b65\u9aa4\u548c\u5de5\u5177\uff0c\u4f60\u5e94\u8be5\u80fd\u591f\u987a\u5229\u5730\u5b89\u88c5Python\u5e93\uff0c\u5e76\u5f00\u59cb\u4f60\u7684Python\u5f00\u53d1\u4e4b\u65c5\u3002\u65e0\u8bba\u662f\u7b80\u5355\u7684\u5355\u4e00\u5e93\u5b89\u88c5\uff0c\u8fd8\u662f\u590d\u6742\u7684\u4f9d\u8d56\u7ba1\u7406\uff0c\u638c\u63e1\u8fd9\u4e9b\u6280\u5de7\u90fd\u5c06\u5e2e\u52a9\u4f60\u66f4\u9ad8\u6548\u5730\u8fdb\u884cPython\u7f16\u7a0b\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728\u4e0d\u540c\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u5b89\u88c5Python\u5e93\uff1f<\/strong><br \/>\u5b89\u88c5Python\u5e93\u7684\u65b9\u5f0f\u56e0\u64cd\u4f5c\u7cfb\u7edf\u800c\u5f02\u3002\u5728Windows\u7cfb\u7edf\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u63d0\u793a\u7b26\u4f7f\u7528<code>pip install \u5e93\u540d<\/code>\u547d\u4ee4\u5b89\u88c5\u3002\u5728macOS\u548cLinux\u7cfb\u7edf\u4e2d\uff0c\u5219\u53ef\u4ee5\u5728\u7ec8\u7aef\u4e2d\u4f7f\u7528\u76f8\u540c\u7684\u547d\u4ee4\u3002\u786e\u4fdd\u5df2\u7ecf\u5b89\u88c5\u4e86Python\u548cpip\uff0c\u624d\u80fd\u987a\u5229\u8fdb\u884c\u5e93\u7684\u5b89\u88c5\u3002<\/p>\n<p><strong>\u5b89\u88c5Python\u5e93\u65f6\u9047\u5230\u9519\u8bef\u5e94\u8be5\u5982\u4f55\u89e3\u51b3\uff1f<\/strong><br \/>\u5728\u5b89\u88c5Python\u5e93\u65f6\uff0c\u53ef\u80fd\u4f1a\u9047\u5230\u5404\u79cd\u9519\u8bef\uff0c\u5982\u201c\u627e\u4e0d\u5230\u5305\u201d\u6216\u201c\u6743\u9650\u4e0d\u8db3\u201d\u7b49\u3002\u5e38\u89c1\u7684\u89e3\u51b3\u65b9\u6cd5\u5305\u62ec\u786e\u4fdd\u4f7f\u7528\u6700\u65b0\u7248\u672c\u7684pip\uff0c\u68c0\u67e5\u5e93\u540d\u662f\u5426\u62fc\u5199\u6b63\u786e\uff0c\u6216\u4f7f\u7528<code>sudo pip install \u5e93\u540d<\/code>\u547d\u4ee4\u6765\u83b7\u53d6\u7ba1\u7406\u5458\u6743\u9650\u3002\u5982\u679c\u95ee\u9898\u4f9d\u65e7\u5b58\u5728\uff0c\u53ef\u4ee5\u67e5\u9605\u76f8\u5173\u5e93\u7684\u6587\u6863\u6216\u5728\u793e\u533a\u8bba\u575b\u5bfb\u6c42\u5e2e\u52a9\u3002<\/p>\n<p><strong>\u5982\u4f55\u7ba1\u7406\u5df2\u5b89\u88c5\u7684Python\u5e93\uff1f<\/strong><br \/>\u7ba1\u7406\u5df2\u5b89\u88c5\u7684Python\u5e93\u53ef\u4ee5\u901a\u8fc7<code>pip list<\/code>\u547d\u4ee4\u67e5\u770b\u5f53\u524d\u5df2\u5b89\u88c5\u7684\u5e93\u53ca\u5176\u7248\u672c\u3002\u5982\u679c\u9700\u8981\u66f4\u65b0\u67d0\u4e2a\u5e93\uff0c\u53ef\u4ee5\u4f7f\u7528<code>pip install --upgrade \u5e93\u540d<\/code>\u547d\u4ee4\u3002\u6b64\u5916\uff0c\u4f7f\u7528<code>pip freeze &gt; requirements.txt<\/code>\u53ef\u4ee5\u751f\u6210\u4e00\u4e2a\u5305\u542b\u5f53\u524d\u73af\u5883\u4e2d\u6240\u6709\u5e93\u53ca\u5176\u7248\u672c\u7684\u6587\u672c\u6587\u4ef6\uff0c\u4ee5\u4fbf\u540e\u7eed\u7684\u73af\u5883\u91cd\u5efa\u6216\u5171\u4eab\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5982\u4f55\u81ea\u5df1\u5b89\u88c5Python\u5e93 \u5b89\u88c5Python\u5e93\u7684\u6b65\u9aa4\u5305\u62ec\uff1a\u68c0\u67e5Python\u548cpip\u7684\u5b89\u88c5\u3001\u4f7f\u7528pip\u547d\u4ee4\u5b89\u88c5\u5e93 [&hellip;]","protected":false},"author":3,"featured_media":965219,"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\/965211"}],"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=965211"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/965211\/revisions"}],"predecessor-version":[{"id":965221,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/965211\/revisions\/965221"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/965219"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=965211"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=965211"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=965211"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}