{"id":1020331,"date":"2024-12-27T13:10:47","date_gmt":"2024-12-27T05:10:47","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1020331.html"},"modified":"2024-12-27T13:10:50","modified_gmt":"2024-12-27T05:10:50","slug":"idea%e5%a6%82%e4%bd%95%e4%b8%8b%e8%bd%bdpython%e5%ba%93","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1020331.html","title":{"rendered":"idea\u5982\u4f55\u4e0b\u8f7dpython\u5e93"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/25162735\/00b1a57d-4c16-4b6f-bfe9-5d1c95746e6f.webp\" alt=\"idea\u5982\u4f55\u4e0b\u8f7dpython\u5e93\" \/><\/p>\n<p><p> \u4e0b\u8f7dPython\u5e93\u7684\u65b9\u6cd5\u6709\u591a\u79cd\uff0c\u5176\u4e2d\u6700\u5e38\u7528\u7684\u65b9\u5f0f\u662f\u901a\u8fc7Python\u7684\u5305\u7ba1\u7406\u5de5\u5177pip\u8fdb\u884c\u5b89\u88c5\u3002<strong>\u53ef\u4ee5\u4f7f\u7528pip\u547d\u4ee4\u3001\u4f7f\u7528IDE\u5185\u7f6e\u529f\u80fd\u3001\u4ece\u6e90\u7801\u5b89\u88c5\u3001\u901a\u8fc7Anaconda\u4e0b\u8f7d<\/strong>\u3002\u5176\u4e2d<strong>\u4f7f\u7528pip\u547d\u4ee4<\/strong>\u662f\u6700\u5e38\u7528\u7684\u65b9\u6cd5\u3002pip\u662fPython\u5b98\u65b9\u63a8\u8350\u7684\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u901a\u8fc7\u7b80\u5355\u7684\u547d\u4ee4\u884c\u6307\u4ee4\u5373\u53ef\u65b9\u4fbf\u5730\u5b89\u88c5\u3001\u5347\u7ea7\u548c\u5378\u8f7dPython\u5e93\u3002\u4ee5\u4e0b\u662f\u8be6\u7ec6\u7684\u64cd\u4f5c\u6b65\u9aa4\uff1a<\/p>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u4f60\u9700\u8981\u786e\u4fdd\u4f60\u7684\u7cfb\u7edf\u4e0a\u5df2\u7ecf\u5b89\u88c5\u4e86Python\u548cpip\u3002\u5927\u591a\u6570\u73b0\u4ee3Python\u5b89\u88c5\u5305\u5df2\u7ecf\u5305\u542b\u4e86pip\uff0c\u56e0\u6b64\u4f60\u53ef\u4ee5\u76f4\u63a5\u5728\u547d\u4ee4\u884c\u4e2d\u8f93\u5165<code>pip --version<\/code>\u6765\u68c0\u67e5pip\u662f\u5426\u53ef\u7528\u3002\u5982\u679c\u672a\u5b89\u88c5\uff0c\u4f60\u53ef\u4ee5\u4ecePython\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u6700\u65b0\u7684Python\u5b89\u88c5\u5305\u5e76\u5b89\u88c5\uff0c\u5176\u4e2d\u5305\u542b\u4e86pip\u3002\u5728\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u5efa\u8bae\u66f4\u65b0pip\u5230\u6700\u65b0\u7248\u672c\uff0c\u4ee5\u907f\u514d\u6f5c\u5728\u7684\u517c\u5bb9\u6027\u95ee\u9898\u3002\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4<code>python -m pip install --upgrade pip<\/code>\u6765\u66f4\u65b0pip\u3002\u4e00\u65e6pip\u51c6\u5907\u5c31\u7eea\uff0c\u4f60\u4fbf\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4<code>pip install \u5305\u540d<\/code>\u6765\u5b89\u88c5\u6240\u9700\u7684Python\u5e93\u3002\u4f8b\u5982\uff0c\u5982\u679c\u4f60\u60f3\u5b89\u88c5NumPy\u5e93\uff0c\u53ea\u9700\u5728\u547d\u4ee4\u884c\u4e2d\u8f93\u5165<code>pip install numpy<\/code>\u3002\u8fd9\u6837\uff0cpip\u4f1a\u81ea\u52a8\u4e0b\u8f7d\u5e76\u5b89\u88c5NumPy\u53ca\u5176\u4f9d\u8d56\u9879\u3002<\/p>\n<\/p>\n<hr>\n<p><p>\u4e00\u3001\u4f7f\u7528PIP\u547d\u4ee4<\/p>\n<\/p>\n<p><p>\u4f7f\u7528pip\u547d\u4ee4\u5b89\u88c5Python\u5e93\u662f\u6700\u5e38\u89c1\u548c\u7b80\u5355\u7684\u65b9\u6cd5\u3002pip\u662fPython\u7684\u5b98\u65b9\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u884c\u6765\u5b89\u88c5\u3001\u66f4\u65b0\u548c\u5378\u8f7dPython\u5e93\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u5b89\u88c5Python\u548cPIP<\/strong><\/p>\n<\/p>\n<p><p>\u9996\u5148\u786e\u4fdd\u4f60\u7684\u7cfb\u7edf\u4e0a\u5df2\u7ecf\u5b89\u88c5\u4e86Python\u548cpip\u3002\u5927\u591a\u6570\u73b0\u4ee3Python\u5b89\u88c5\u5305\u90fd\u5df2\u7ecf\u5305\u542b\u4e86pip\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u5728\u547d\u4ee4\u884c\u4e2d\u8f93\u5165<code>python --version<\/code>\u548c<code>pip --version<\/code>\u6765\u68c0\u67e5\u5b83\u4eec\u662f\u5426\u5df2\u7ecf\u5b89\u88c5\u3002\u5982\u679c\u6ca1\u6709\u5b89\u88c5\uff0c\u53ef\u4ee5\u4ecePython\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u6700\u65b0\u7684\u5b89\u88c5\u5305\uff0c\u5b89\u88c5\u8fc7\u7a0b\u975e\u5e38\u7b80\u5355\uff0c\u901a\u5e38\u53ea\u662f\u70b9\u51fb\u51e0\u4e0b\u201c\u4e0b\u4e00\u6b65\u201d\u3002<\/p>\n<\/p>\n<p><p>\u5728\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0c\u786e\u4fdd\u52fe\u9009\u4e86\u201cAdd Python to PATH\u201d\u9009\u9879\uff0c\u4ee5\u4fbf\u5728\u547d\u4ee4\u884c\u4e2d\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528Python\u548cpip\u547d\u4ee4\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4f7f\u7528PIP\u5b89\u88c5\u5e93<\/strong><\/p>\n<\/p>\n<p><p>\u5b89\u88c5\u5e93\u7684\u547d\u4ee4\u683c\u5f0f\u4e3a<code>pip install \u5e93\u540d<\/code>\u3002\u4f8b\u5982\uff0c\u5982\u679c\u4f60\u60f3\u5b89\u88c5\u540d\u4e3arequests\u7684\u5e93\uff0c\u53ea\u9700\u5728\u547d\u4ee4\u884c\u4e2d\u8f93\u5165<code>pip install requests<\/code>\u3002pip\u4f1a\u81ea\u52a8\u4ecePython Package Index\uff08PyPI\uff09\u4e0b\u8f7d\u5e76\u5b89\u88c5\u8be5\u5e93\u53ca\u5176\u6240\u6709\u4f9d\u8d56\u9879\u3002<\/p>\n<\/p>\n<p><p>\u53ef\u4ee5\u901a\u8fc7<code>pip install \u5e93\u540d==\u7248\u672c\u53f7<\/code>\u6307\u5b9a\u5b89\u88c5\u7279\u5b9a\u7248\u672c\u7684\u5e93\uff0c\u4f8b\u5982<code>pip install requests==2.25.1<\/code>\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u7ba1\u7406\u5df2\u5b89\u88c5\u7684\u5e93<\/strong><\/p>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528<code>pip list<\/code>\u547d\u4ee4\u67e5\u770b\u5f53\u524d\u7cfb\u7edf\u4e2d\u5df2\u5b89\u88c5\u7684\u6240\u6709Python\u5e93\u53ca\u5176\u7248\u672c\u3002\u4f7f\u7528<code>pip uninstall \u5e93\u540d<\/code>\u547d\u4ee4\u53ef\u4ee5\u5378\u8f7d\u4e0d\u9700\u8981\u7684\u5e93\u3002<\/p>\n<\/p>\n<p><p>\u5982\u679c\u60f3\u5347\u7ea7\u67d0\u4e2a\u5e93\u5230\u6700\u65b0\u7248\u672c\uff0c\u53ef\u4ee5\u4f7f\u7528<code>pip install --upgrade \u5e93\u540d<\/code>\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e8c\u3001\u4f7f\u7528IDE\u5185\u7f6e\u529f\u80fd<\/p>\n<\/p>\n<p><p>\u8bb8\u591a\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u63d0\u4f9b\u4e86\u5185\u7f6e\u7684\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u4f7f\u5f97\u5b89\u88c5\u548c\u7ba1\u7406Python\u5e93\u66f4\u52a0\u4fbf\u6377\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u7528IDE\u7684\u5177\u4f53\u64cd\u4f5c\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>PyCharm<\/strong><\/p>\n<\/p>\n<p><p>PyCharm\u662f\u4e00\u4e2a\u529f\u80fd\u5f3a\u5927\u7684Python IDE\uff0c\u63d0\u4f9b\u4e86\u56fe\u5f62\u5316\u7684\u5305\u7ba1\u7406\u5668\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u6765\u5b89\u88c5Python\u5e93\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u6253\u5f00PyCharm\u5e76\u8fdb\u5165\u4e00\u4e2a\u9879\u76ee\u3002<\/li>\n<li>\u5728\u83dc\u5355\u4e2d\u9009\u62e9\u201cFile\u201d -&gt; \u201cSettings\u201d\uff08\u5728Mac\u4e0a\u662f\u201cPyCharm\u201d -&gt; \u201cPreferences\u201d\uff09\u3002<\/li>\n<li>\u5728\u5de6\u4fa7\u5bfc\u822a\u4e2d\u9009\u62e9\u201cProject: \u9879\u76ee\u540d\u201d -&gt; \u201cPython Interpreter\u201d\u3002<\/li>\n<li>\u5728\u53f3\u4fa7\u7a97\u53e3\u4e2d\u70b9\u51fb\u201c+\u201d\u6309\u94ae\u6765\u6dfb\u52a0\u65b0\u7684\u5305\u3002<\/li>\n<li>\u5728\u5f39\u51fa\u7684\u7a97\u53e3\u4e2d\u641c\u7d22\u4f60\u9700\u8981\u7684\u5e93\uff0c\u70b9\u51fb\u201cInstall Package\u201d\u6309\u94ae\u8fdb\u884c\u5b89\u88c5\u3002<\/li>\n<\/ul>\n<\/li>\n<li>\n<p><strong>Visual Studio Code<\/strong><\/p>\n<\/p>\n<p><p>Visual Studio Code\uff08VS Code\uff09\u662f\u53e6\u4e00\u4e2a\u6d41\u884c\u7684\u4ee3\u7801\u7f16\u8f91\u5668\uff0c\u652f\u6301\u591a\u79cd\u7f16\u7a0b\u8bed\u8a00\u3002\u5c3d\u7ba1VS Code\u672c\u8eab\u6ca1\u6709\u5185\u7f6e\u7684\u5305\u7ba1\u7406\u5668\uff0c\u4f46\u4f60\u53ef\u4ee5\u901a\u8fc7\u96c6\u6210\u7684\u7ec8\u7aef\u6765\u4f7f\u7528pip\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u6253\u5f00VS Code\u5e76\u8fdb\u5165\u4e00\u4e2a\u9879\u76ee\u3002<\/li>\n<li>\u70b9\u51fb\u9876\u90e8\u83dc\u5355\u4e2d\u7684\u201cTerminal\u201d -&gt; \u201cNew Terminal\u201d\u6253\u5f00\u7ec8\u7aef\u3002<\/li>\n<li>\u5728\u7ec8\u7aef\u4e2d\u8f93\u5165<code>pip install \u5e93\u540d<\/code>\u6765\u5b89\u88c5\u6240\u9700\u7684\u5e93\u3002<\/li>\n<\/ul>\n<p><p>\u6b64\u5916\uff0cVS Code\u63d0\u4f9b\u4e86Python\u6269\u5c55\uff0c\u53ef\u4ee5\u5e2e\u52a9\u4f60\u66f4\u597d\u5730\u7ba1\u7406Python\u73af\u5883\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e09\u3001\u4ece\u6e90\u7801\u5b89\u88c5<\/p>\n<\/p>\n<p><p>\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u4f60\u53ef\u80fd\u9700\u8981\u4ece\u6e90\u7801\u5b89\u88c5Python\u5e93\uff0c\u7279\u522b\u662f\u5f53\u5e93\u6ca1\u6709\u5728PyPI\u4e0a\u53d1\u5e03\uff0c\u6216\u8005\u4f60\u9700\u8981\u5b89\u88c5\u5e93\u7684\u5f00\u53d1\u7248\u672c\u65f6\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u4e0b\u8f7d\u6e90\u7801<\/strong><\/p>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u4f60\u9700\u8981\u4ece\u9879\u76ee\u7684\u5b98\u65b9\u7f51\u7ad9\u6216\u4ee3\u7801\u6258\u7ba1\u5e73\u53f0\uff08\u5982GitHub\uff09\u4e0b\u8f7d\u6e90\u7801\u3002\u901a\u5e38\uff0c\u8fd9\u4e9b\u7f51\u7ad9\u4f1a\u63d0\u4f9b\u4e00\u4e2a\u4e0b\u8f7d\u94fe\u63a5\uff0c\u6216\u8005\u4f60\u53ef\u4ee5\u4f7f\u7528git\u547d\u4ee4\u514b\u9686\u4ee3\u7801\u4ed3\u5e93\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5b89\u88c5\u4f9d\u8d56<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u5b89\u88c5\u6e90\u7801\u4e4b\u524d\uff0c\u786e\u4fdd\u6240\u6709\u5fc5\u8981\u7684\u4f9d\u8d56\u9879\u90fd\u5df2\u5b89\u88c5\u3002\u8bb8\u591a\u9879\u76ee\u4f1a\u5728\u5176\u6587\u6863\u4e2d\u5217\u51fa\u9700\u8981\u7684\u4f9d\u8d56\u5e93\uff0c\u5e76\u63d0\u4f9b\u4e00\u4e2arequirements.txt\u6587\u4ef6\u3002\u4f60\u53ef\u4ee5\u901a\u8fc7<code>pip install -r requirements.txt<\/code>\u547d\u4ee4\u6765\u5b89\u88c5\u8fd9\u4e9b\u4f9d\u8d56\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6784\u5efa\u548c\u5b89\u88c5<\/strong><\/p>\n<\/p>\n<p><p>\u4e0b\u8f7d\u6e90\u7801\u540e\uff0c\u8fdb\u5165\u6e90\u7801\u76ee\u5f55\uff0c\u5e76\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u5b89\u88c5\u5e93\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">python setup.py install<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u6784\u5efa\u5e93\u5e76\u5c06\u5176\u5b89\u88c5\u5230\u4f60\u7684Python\u73af\u5883\u4e2d\u3002\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7import\u8bed\u53e5\u5728\u4ee3\u7801\u4e2d\u4f7f\u7528\u8be5\u5e93\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u56db\u3001\u901a\u8fc7Anaconda\u4e0b\u8f7d<\/p>\n<\/p>\n<p><p>Anaconda\u662f\u4e00\u4e2a\u6d41\u884c\u7684\u6570\u636e\u79d1\u5b66\u548c<a href=\"https:\/\/docs.pingcode.com\/ask\/59192.html\" target=\"_blank\">\u673a\u5668\u5b66\u4e60<\/a>\u5e73\u53f0\uff0c\u63d0\u4f9b\u4e86\u4e00\u4e2a\u540d\u4e3aconda\u7684\u5305\u7ba1\u7406\u5668\u3002conda\u4e0d\u4ec5\u53ef\u4ee5\u7ba1\u7406Python\u5e93\uff0c\u8fd8\u53ef\u4ee5\u7ba1\u7406\u6574\u4e2aPython\u73af\u5883\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u5b89\u88c5Anaconda<\/strong><\/p>\n<\/p>\n<p><p>\u9996\u5148\uff0c\u4eceAnaconda\u5b98\u65b9\u7f51\u7ad9\u4e0b\u8f7d\u5e76\u5b89\u88c5Anaconda\u3002\u5b89\u88c5\u8fc7\u7a0b\u4e2d\uff0c\u786e\u4fdd\u9009\u62e9\u5c06Anaconda\u6dfb\u52a0\u5230\u7cfb\u7edfPATH\u4e2d\uff0c\u4ee5\u4fbf\u5728\u547d\u4ee4\u884c\u4e2d\u53ef\u4ee5\u76f4\u63a5\u4f7f\u7528conda\u547d\u4ee4\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u521b\u5efa\u865a\u62df\u73af\u5883<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528conda\u53ef\u4ee5\u8f7b\u677e\u521b\u5efa\u548c\u7ba1\u7406\u865a\u62df\u73af\u5883\uff0c\u8fd9\u5bf9\u4e8e\u9694\u79bb\u9879\u76ee\u4f9d\u8d56\u975e\u5e38\u6709\u7528\u3002\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u547d\u4ee4\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Python\u73af\u5883\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">conda create --name myenv python=3.8<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd9\u5c06\u521b\u5efa\u4e00\u4e2a\u540d\u4e3amyenv\u7684\u865a\u62df\u73af\u5883\uff0c\u5e76\u5b89\u88c5Python 3.8\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6fc0\u6d3b\u865a\u62df\u73af\u5883<\/strong><\/p>\n<\/p>\n<p><p>\u521b\u5efa\u73af\u5883\u540e\uff0c\u4f60\u9700\u8981\u6fc0\u6d3b\u5b83\u4ee5\u4fbf\u4f7f\u7528\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">conda activate myenv<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6fc0\u6d3b\u73af\u5883\u540e\uff0c\u4f60\u53ef\u4ee5\u901a\u8fc7<code>conda list<\/code>\u67e5\u770b\u5df2\u5b89\u88c5\u7684\u5e93\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u5b89\u88c5Python\u5e93<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528conda\u53ef\u4ee5\u5b89\u88c5Python\u5e93\uff0c\u547d\u4ee4\u683c\u5f0f\u4e3a<code>conda install \u5e93\u540d<\/code>\u3002\u4f8b\u5982\uff0c\u8981\u5b89\u88c5NumPy\uff0c\u53ef\u4ee5\u8f93\u5165\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">conda install numpy<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>conda\u4f1a\u81ea\u52a8\u5904\u7406\u4f9d\u8d56\u5e76\u5b89\u88c5\u5e93\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u4e94\u3001\u5e38\u89c1\u95ee\u9898\u53ca\u89e3\u51b3\u65b9\u6848<\/p>\n<\/p>\n<p><p>\u5728\u5b89\u88c5Python\u5e93\u7684\u8fc7\u7a0b\u4e2d\uff0c\u53ef\u80fd\u4f1a\u9047\u5230\u4e00\u4e9b\u5e38\u89c1\u95ee\u9898\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u95ee\u9898\u53ca\u5176\u89e3\u51b3\u65b9\u6848\u3002<\/p>\n<\/p>\n<ol>\n<li>\n<p><strong>\u7f51\u7edc\u95ee\u9898<\/strong><\/p>\n<\/p>\n<p><p>\u5728\u67d0\u4e9b\u60c5\u51b5\u4e0b\uff0c\u7f51\u7edc\u8fde\u63a5\u4e0d\u7a33\u5b9a\u53ef\u80fd\u5bfc\u81f4pip\u6216conda\u65e0\u6cd5\u4e0b\u8f7d\u5e93\u3002\u53ef\u4ee5\u5c1d\u8bd5\u4f7f\u7528\u56fd\u5185\u955c\u50cf\u6765\u52a0\u901f\u4e0b\u8f7d\u3002\u4f8b\u5982\uff0c\u5bf9\u4e8epip\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528\u8c46\u74e3\u7684\u955c\u50cf\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-bash\">pip install \u5e93\u540d -i https:\/\/pypi.douban.com\/simple<\/p>\n<p><\/code><\/pre>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u6743\u9650\u95ee\u9898<\/strong><\/p>\n<\/p>\n<p><p>\u5982\u679c\u5728\u5b89\u88c5\u5e93\u65f6\u9047\u5230\u6743\u9650\u95ee\u9898\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u5728\u547d\u4ee4\u524d\u52a0\u4e0a<code>sudo<\/code>\uff08\u5bf9\u4e8eLinux\u548cMac\uff09\u6216\u4ee5\u7ba1\u7406\u5458\u8eab\u4efd\u8fd0\u884c\u547d\u4ee4\u63d0\u793a\u7b26\uff08\u5bf9\u4e8eWindows\uff09\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u7248\u672c\u51b2\u7a81<\/strong><\/p>\n<\/p>\n<p><p>\u5f53\u5e93\u4e4b\u95f4\u5b58\u5728\u7248\u672c\u51b2\u7a81\u65f6\uff0c\u53ef\u80fd\u4f1a\u5bfc\u81f4\u5b89\u88c5\u5931\u8d25\u3002\u53ef\u4ee5\u5c1d\u8bd5\u521b\u5efa\u4e00\u4e2a\u65b0\u7684\u865a\u62df\u73af\u5883\uff0c\u5e76\u5728\u5176\u4e2d\u5b89\u88c5\u6240\u9700\u7684\u5e93\uff0c\u4ee5\u907f\u514d\u7248\u672c\u51b2\u7a81\u3002<\/p>\n<\/p>\n<\/li>\n<li>\n<p><strong>\u4f9d\u8d56\u95ee\u9898<\/strong><\/p>\n<\/p>\n<p><p>\u67d0\u4e9b\u5e93\u53ef\u80fd\u9700\u8981\u7cfb\u7edf\u7ea7\u522b\u7684\u4f9d\u8d56\uff0c\u4f8b\u5982C++\u7f16\u8bd1\u5668\u6216\u7279\u5b9a\u7684\u64cd\u4f5c\u7cfb\u7edf\u5e93\u3002\u53ef\u4ee5\u67e5\u9605\u5e93\u7684\u6587\u6863\u4ee5\u4e86\u89e3\u9700\u8981\u5b89\u88c5\u54ea\u4e9b\u4f9d\u8d56\uff0c\u5e76\u786e\u4fdd\u5b83\u4eec\u5df2\u6b63\u786e\u5b89\u88c5\u5728\u7cfb\u7edf\u4e2d\u3002<\/p>\n<\/p>\n<\/li>\n<\/ol>\n<p><p>\u516d\u3001\u603b\u7ed3<\/p>\n<\/p>\n<p><p>\u5728\u672c\u7bc7\u6587\u7ae0\u4e2d\uff0c\u6211\u4eec\u8be6\u7ec6\u4ecb\u7ecd\u4e86\u5982\u4f55\u4e0b\u8f7d\u548c\u5b89\u88c5Python\u5e93\u7684\u591a\u79cd\u65b9\u6cd5\u3002<strong>\u4f7f\u7528pip\u547d\u4ee4\u3001\u4f7f\u7528IDE\u5185\u7f6e\u529f\u80fd\u3001\u4ece\u6e90\u7801\u5b89\u88c5\u3001\u901a\u8fc7Anaconda\u4e0b\u8f7d<\/strong>\u90fd\u662f\u5e38\u7528\u7684\u65b9\u5f0f\u3002\u6bcf\u79cd\u65b9\u6cd5\u90fd\u6709\u5176\u9002\u7528\u7684\u573a\u666f\u548c\u4f18\u7f3a\u70b9\uff0c\u9009\u62e9\u5408\u9002\u7684\u65b9\u6cd5\u53ef\u4ee5\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\u548c\u9879\u76ee\u7684\u53ef\u7ef4\u62a4\u6027\u3002<\/p>\n<\/p>\n<p><p>\u901a\u8fc7\u5b66\u4e60\u8fd9\u4e9b\u65b9\u6cd5\uff0c\u4f60\u5c06\u80fd\u591f\u66f4\u597d\u5730\u7ba1\u7406Python\u9879\u76ee\u4e2d\u7684\u4f9d\u8d56\uff0c\u786e\u4fdd\u4ee3\u7801\u5728\u4e0d\u540c\u73af\u5883\u4e2d\u90fd\u80fd\u6b63\u5e38\u8fd0\u884c\u3002\u540c\u65f6\uff0c\u4e86\u89e3\u5982\u4f55\u89e3\u51b3\u5e38\u89c1\u95ee\u9898\u4e5f\u80fd\u5e2e\u52a9\u4f60\u5728\u9047\u5230\u56f0\u96be\u65f6\u5feb\u901f\u627e\u5230\u89e3\u51b3\u65b9\u6848\u3002\u65e0\u8bba\u662f\u65b0\u624b\u8fd8\u662f\u7ecf\u9a8c\u4e30\u5bcc\u7684\u5f00\u53d1\u8005\uff0c\u638c\u63e1\u8fd9\u4e9b\u6280\u80fd\u90fd\u662f\u975e\u5e38\u91cd\u8981\u7684\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u5728IDEA\u4e2d\u5b89\u88c5Python\u5e93\uff1f<\/strong><br \/>\u5728IDEA\u4e2d\uff0c\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u5b89\u88c5Python\u5e93\uff1a\u6253\u5f00\u4f60\u7684\u9879\u76ee\uff0c\u627e\u5230\u201cTerminal\u201d\u7a97\u53e3\uff0c\u8f93\u5165<code>pip install \u5e93\u540d<\/code>\uff0c\u6309\u56de\u8f66\u952e\u5373\u53ef\u5f00\u59cb\u4e0b\u8f7d\u548c\u5b89\u88c5\u6240\u9700\u7684Python\u5e93\u3002\u5982\u679c\u4f7f\u7528\u7684\u662fPyCharm\uff0c\u60a8\u8fd8\u53ef\u4ee5\u5728\u201cProject Interpreter\u201d\u8bbe\u7f6e\u4e2d\u76f4\u63a5\u6dfb\u52a0\u5e93\u3002<\/p>\n<p><strong>\u5728IDEA\u4e2d\u5982\u4f55\u7ba1\u7406\u5df2\u5b89\u88c5\u7684Python\u5e93\uff1f<\/strong><br \/>\u53ef\u4ee5\u901a\u8fc7IDEA\u7684\u201cSettings\u201d\u6216\u201cPreferences\u201d\u83dc\u5355\uff0c\u627e\u5230\u201cProject Interpreter\u201d\u9009\u9879\uff0c\u67e5\u770b\u548c\u7ba1\u7406\u5df2\u5b89\u88c5\u7684\u5e93\u3002\u5728\u8fd9\u4e2a\u754c\u9762\u4e2d\uff0c\u53ef\u4ee5\u67e5\u770b\u5e93\u7684\u7248\u672c\uff0c\u66f4\u65b0\u6216\u5378\u8f7d\u4e0d\u518d\u9700\u8981\u7684\u5e93\u3002<\/p>\n<p><strong>IDEA\u652f\u6301\u54ea\u4e9bPython\u5e93\u7684\u4e0b\u8f7d\u548c\u4f7f\u7528\uff1f<\/strong><br \/>IDEA\u652f\u6301\u7edd\u5927\u591a\u6570Python\u5e93\uff0c\u53ea\u8981\u8fd9\u4e9b\u5e93\u5728Python Package Index (PyPI)\u4e0a\u53ef\u7528\u3002\u5e38\u89c1\u7684\u5e93\u5982NumPy\u3001Pandas\u3001Flask\u7b49\u90fd\u53ef\u4ee5\u901a\u8fc7IDEA\u76f4\u63a5\u4e0b\u8f7d\u548c\u4f7f\u7528\u3002\u6b64\u5916\uff0c\u7528\u6237\u8fd8\u53ef\u4ee5\u901a\u8fc7<code>requirements.txt<\/code>\u6587\u4ef6\u6279\u91cf\u5b89\u88c5\u9879\u76ee\u6240\u9700\u7684\u5e93\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u4e0b\u8f7dPython\u5e93\u7684\u65b9\u6cd5\u6709\u591a\u79cd\uff0c\u5176\u4e2d\u6700\u5e38\u7528\u7684\u65b9\u5f0f\u662f\u901a\u8fc7Python\u7684\u5305\u7ba1\u7406\u5de5\u5177pip\u8fdb\u884c\u5b89\u88c5\u3002\u53ef\u4ee5\u4f7f\u7528pip\u547d [&hellip;]","protected":false},"author":3,"featured_media":1020336,"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\/1020331"}],"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=1020331"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1020331\/revisions"}],"predecessor-version":[{"id":1020337,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1020331\/revisions\/1020337"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1020336"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1020331"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1020331"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1020331"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}