{"id":1085637,"date":"2025-01-08T13:18:01","date_gmt":"2025-01-08T05:18:01","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1085637.html"},"modified":"2025-01-08T13:18:08","modified_gmt":"2025-01-08T05:18:08","slug":"%e5%a6%82%e4%bd%95%e5%9c%a8win7%e4%b8%8a%e5%ae%89%e8%a3%85python-2","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1085637.html","title":{"rendered":"\u5982\u4f55\u5728win7\u4e0a\u5b89\u88c5python"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24195422\/0dac356d-d2c7-426e-b999-e480aaebfdb4.webp\" alt=\"\u5982\u4f55\u5728win7\u4e0a\u5b89\u88c5python\" \/><\/p>\n<p><p> <strong>\u5982\u4f55\u5728win7\u4e0a\u5b89\u88c5python<\/strong><\/p>\n<\/p>\n<p><p>\u5728Windows 7\u4e0a\u5b89\u88c5Python\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u51e0\u4e2a\u6b65\u9aa4\u6765\u5b8c\u6210\uff1a\u4e0b\u8f7dPython\u5b89\u88c5\u5305\u3001\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f\u3001\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u3001\u9a8c\u8bc1\u5b89\u88c5\u3002\u8fd9\u4e9b\u6b65\u9aa4\u786e\u4fdd\u4e86Python\u80fd\u591f\u5728Windows 7\u4e0a\u6b63\u5e38\u8fd0\u884c\uff0c\u5e76\u4e14\u53ef\u4ee5\u4ece\u547d\u4ee4\u63d0\u793a\u7b26\u4e2d\u8bbf\u95ee\u3002<strong>\u4e0b\u8f7dPython\u5b89\u88c5\u5305\u3001\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f\u3001\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u3001\u9a8c\u8bc1\u5b89\u88c5<\/strong>\u662f\u5173\u952e\u6b65\u9aa4\u3002\u4ee5\u4e0b\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u6bcf\u4e00\u6b65\u7684\u5177\u4f53\u64cd\u4f5c\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u4e0b\u8f7dPython\u5b89\u88c5\u5305<\/h3>\n<\/p>\n<p><p>\u8981\u5728Windows 7\u4e0a\u5b89\u88c5Python\uff0c\u9996\u5148\u9700\u8981\u4e0b\u8f7dPython\u5b89\u88c5\u5305\u3002\u5efa\u8bae\u4ecePython\u7684\u5b98\u65b9\u7f51\u7ad9\uff08<a href=\"https:\/\/www.python.org\/%EF%BC%89%E4%B8%8B%E8%BD%BD%EF%BC%8C%E7%A1%AE%E4%BF%9D%E4%B8%8B%E8%BD%BD%E7%9A%84%E6%98%AF%E6%9C%80%E6%96%B0%E7%A8%B3%E5%AE%9A%E7%89%88%E6%9C%AC%E3%80%82\">https:\/\/www.python.org\/\uff09\u4e0b\u8f7d\uff0c\u786e\u4fdd\u4e0b\u8f7d\u7684\u662f\u6700\u65b0\u7a33\u5b9a\u7248\u672c\u3002<\/a><\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u6d4f\u89c8\u5668\uff0c\u8bbf\u95eePython\u5b98\u65b9\u7f51\u7ad9\u3002<\/li>\n<li>\u70b9\u51fb\u5bfc\u822a\u680f\u4e2d\u7684\u201cDownloads\u201d\u9009\u9879\u3002<\/li>\n<li>\u5728\u4e0b\u8f7d\u9875\u9762\u4e2d\uff0c\u627e\u5230\u9002\u7528\u4e8eWindows\u7684\u6700\u65b0\u7248\u672c\uff08Python 3.x\uff09\u3002<\/li>\n<li>\u70b9\u51fb\u201cDownload\u201d\u6309\u94ae\uff0c\u4e0b\u8f7d\u76f8\u5e94\u7684\u5b89\u88c5\u5305\u3002<\/li>\n<\/ol>\n<p><h3>\u4e8c\u3001\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f<\/h3>\n<\/p>\n<p><p>\u4e0b\u8f7d\u5b8c\u6210\u540e\uff0c\u53cc\u51fb\u4e0b\u8f7d\u7684\u5b89\u88c5\u5305\u8fd0\u884c\u5b89\u88c5\u7a0b\u5e8f\uff0c\u6309\u7167\u4ee5\u4e0b\u6b65\u9aa4\u8fdb\u884c\u5b89\u88c5\uff1a<\/p>\n<\/p>\n<ol>\n<li>\u53cc\u51fb\u4e0b\u8f7d\u7684\u5b89\u88c5\u5305\uff0c\u542f\u52a8\u5b89\u88c5\u7a0b\u5e8f\u3002<\/li>\n<li>\u5728\u51fa\u73b0\u7684\u5b89\u88c5\u754c\u9762\u4e2d\uff0c\u52fe\u9009\u201cAdd Python to PATH\u201d\u9009\u9879\uff0c\u8fd9\u4e00\u6b65\u975e\u5e38\u91cd\u8981\uff0c\u5b83\u4f1a\u5c06Python\u6dfb\u52a0\u5230\u7cfb\u7edf\u8def\u5f84\u4e2d\uff0c\u4fbf\u4e8e\u540e\u7eed\u4f7f\u7528\u3002<\/li>\n<li>\u70b9\u51fb\u201cCustomize installation\u201d\u9009\u9879\uff0c\u53ef\u4ee5\u81ea\u5b9a\u4e49\u5b89\u88c5\u8def\u5f84\u548c\u5176\u4ed6\u9009\u9879\uff0c\u5efa\u8bae\u4f7f\u7528\u9ed8\u8ba4\u8bbe\u7f6e\u3002<\/li>\n<li>\u70b9\u51fb\u201cNext\u201d\u6309\u94ae\uff0c\u7ee7\u7eed\u5b89\u88c5\u3002<\/li>\n<li>\u5728\u201cOptional Features\u201d\u9875\u9762\uff0c\u786e\u4fdd\u201cpip\u201d\u548c\u201cIDLE\u201d\u9009\u9879\u88ab\u52fe\u9009\uff0c\u8fd9\u6837\u4f1a\u4e00\u5e76\u5b89\u88c5pip\u548cPython\u7684\u56fe\u5f62\u5316\u7f16\u7a0b\u73af\u5883IDLE\u3002<\/li>\n<li>\u70b9\u51fb\u201cInstall\u201d\u6309\u94ae\uff0c\u5f00\u59cb\u5b89\u88c5Python\u3002<\/li>\n<li>\u7b49\u5f85\u5b89\u88c5\u5b8c\u6210\uff0c\u5b89\u88c5\u5b8c\u6210\u540e\u4f1a\u5f39\u51fa\u4e00\u4e2a\u5bf9\u8bdd\u6846\u63d0\u793a\uff0c\u70b9\u51fb\u201cClose\u201d\u5173\u95ed\u5b89\u88c5\u7a0b\u5e8f\u3002<\/li>\n<\/ol>\n<p><h3>\u4e09\u3001\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf<\/h3>\n<\/p>\n<p><p>\u867d\u7136\u5728\u5b89\u88c5\u65f6\u5df2\u7ecf\u52fe\u9009\u4e86\u201cAdd Python to PATH\u201d\u9009\u9879\uff0c\u4f46\u4e3a\u4e86\u786e\u4fdd\u4e07\u65e0\u4e00\u5931\uff0c\u5efa\u8bae\u624b\u52a8\u68c0\u67e5\u5e76\u914d\u7f6e\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u3002<\/p>\n<\/p>\n<ol>\n<li>\u53f3\u952e\u70b9\u51fb\u201c\u8ba1\u7b97\u673a\u201d\u56fe\u6807\uff0c\u9009\u62e9\u201c\u5c5e\u6027\u201d\u3002<\/li>\n<li>\u5728\u7cfb\u7edf\u5c5e\u6027\u7a97\u53e3\u4e2d\uff0c\u70b9\u51fb\u5de6\u4fa7\u7684\u201c\u9ad8\u7ea7\u7cfb\u7edf\u8bbe\u7f6e\u201d\u3002<\/li>\n<li>\u5728\u5f39\u51fa\u7684\u7cfb\u7edf\u5c5e\u6027\u5bf9\u8bdd\u6846\u4e2d\uff0c\u70b9\u51fb\u201c\u73af\u5883\u53d8\u91cf\u201d\u6309\u94ae\u3002<\/li>\n<li>\u5728\u201c\u7cfb\u7edf\u53d8\u91cf\u201d\u90e8\u5206\uff0c\u627e\u5230\u5e76\u9009\u62e9\u201cPath\u201d\u53d8\u91cf\uff0c\u70b9\u51fb\u201c\u7f16\u8f91\u201d\u6309\u94ae\u3002<\/li>\n<li>\u5728\u5f39\u51fa\u7684\u7f16\u8f91\u7a97\u53e3\u4e2d\uff0c\u68c0\u67e5\u201c\u53d8\u91cf\u503c\u201d\u4e2d\u662f\u5426\u5305\u542bPython\u7684\u5b89\u88c5\u8def\u5f84\uff08\u4f8b\u5982\uff1aC:\\Python39\\Scripts\\\u548cC:\\Python39\\\uff09\uff0c\u5982\u679c\u6ca1\u6709\u5219\u624b\u52a8\u6dfb\u52a0\u3002<\/li>\n<li>\u70b9\u51fb\u201c\u786e\u5b9a\u201d\u4fdd\u5b58\u66f4\u6539\uff0c\u5173\u95ed\u6240\u6709\u5bf9\u8bdd\u6846\u3002<\/li>\n<\/ol>\n<p><h3>\u56db\u3001\u9a8c\u8bc1\u5b89\u88c5<\/h3>\n<\/p>\n<p><p>\u5b8c\u6210\u4e0a\u8ff0\u6b65\u9aa4\u540e\uff0c\u9700\u8981\u9a8c\u8bc1Python\u662f\u5426\u5b89\u88c5\u6210\u529f\uff0c\u5e76\u786e\u4fdd\u53ef\u4ee5\u6b63\u5e38\u4f7f\u7528\u3002<\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff08\u6309Win+R\uff0c\u8f93\u5165cmd\uff0c\u56de\u8f66\uff09\u3002<\/li>\n<li>\u5728\u547d\u4ee4\u63d0\u793a\u7b26\u7a97\u53e3\u4e2d\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770bPython\u7248\u672c\uff1a\n<pre><code>python --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p>\u5982\u679c\u663e\u793aPython\u7684\u7248\u672c\u53f7\uff08\u4f8b\u5982\uff1aPython 3.9.0\uff09\uff0c\u8bf4\u660e\u5b89\u88c5\u6210\u529f\u3002<\/li>\n<\/p>\n<li>\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u67e5\u770bpip\u7248\u672c\uff1a\n<pre><code>pip --version<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p>\u5982\u679c\u663e\u793apip\u7684\u7248\u672c\u53f7\uff08\u4f8b\u5982\uff1apip 21.0.1\uff09\uff0c\u8bf4\u660epip\u5b89\u88c5\u6210\u529f\u3002<\/li>\n<\/p>\n<li>\u53ef\u4ee5\u8fd0\u884cPython\u4ea4\u4e92\u5f0f\u89e3\u91ca\u5668\uff0c\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a\n<pre><code>python<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p>\u5982\u679c\u770b\u5230Python\u4ea4\u4e92\u5f0f\u89e3\u91ca\u5668\u7684\u63d0\u793a\u7b26\uff08&gt;&gt;&gt;\uff09\uff0c\u8bf4\u660ePython\u53ef\u4ee5\u6b63\u5e38\u8fd0\u884c\u3002<\/li>\n<\/p>\n<\/ol>\n<p><p>\u901a\u8fc7\u4ee5\u4e0a\u6b65\u9aa4\uff0c\u60a8\u5df2\u7ecf\u6210\u529f\u5728Windows 7\u4e0a\u5b89\u88c5\u4e86Python\uff0c\u5e76\u4e14\u5b8c\u6210\u4e86\u73af\u5883\u53d8\u91cf\u7684\u914d\u7f6e\u548c\u5b89\u88c5\u9a8c\u8bc1\u3002\u63a5\u4e0b\u6765\uff0c\u60a8\u53ef\u4ee5\u5f00\u59cb\u4f7f\u7528Python\u8fdb\u884c\u7f16\u7a0b\u548c\u5f00\u53d1\u4e86\u3002<\/p>\n<\/p>\n<p><h3>\u4e94\u3001\u5b89\u88c5\u5e38\u7528Python\u5e93<\/h3>\n<\/p>\n<p><p>Python\u6709\u7740\u4e30\u5bcc\u7684\u7b2c\u4e09\u65b9\u5e93\uff0c\u53ef\u4ee5\u5e2e\u52a9\u5f00\u53d1\u8005\u66f4\u9ad8\u6548\u5730\u5b8c\u6210\u5404\u79cd\u4efb\u52a1\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u7528\u7684Python\u5e93\u53ca\u5176\u5b89\u88c5\u65b9\u6cd5\u3002<\/p>\n<\/p>\n<p><h4>1. \u5b89\u88c5NumPy<\/h4>\n<\/p>\n<p><p>NumPy\u662f\u4e00\u4e2a\u7528\u4e8e\u79d1\u5b66\u8ba1\u7b97\u7684\u5e93\uff0c\u63d0\u4f9b\u4e86\u591a\u7ef4\u6570\u7ec4\u5bf9\u8c61\u548c\u5404\u79cd\u51fd\u6570\u3002\u53ef\u4ee5\u901a\u8fc7pip\u5b89\u88c5NumPy\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">pip install numpy<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u5b89\u88c5Pandas<\/h4>\n<\/p>\n<p><p>Pandas\u662f\u4e00\u4e2a\u6570\u636e\u5206\u6790\u548c\u6570\u636e\u5904\u7406\u5e93\uff0c\u63d0\u4f9b\u4e86\u9ad8\u6548\u7684\u6570\u636e\u7ed3\u6784\u548c\u6570\u636e\u5206\u6790\u5de5\u5177\u3002\u53ef\u4ee5\u901a\u8fc7pip\u5b89\u88c5Pandas\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">pip install pandas<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3. \u5b89\u88c5Matplotlib<\/h4>\n<\/p>\n<p><p>Matplotlib\u662f\u4e00\u4e2a\u7ed8\u56fe\u5e93\uff0c\u53ef\u4ee5\u7528\u4e8e\u521b\u5efa\u5404\u79cd\u9759\u6001\u3001\u52a8\u6001\u548c\u4ea4\u4e92\u5f0f\u56fe\u8868\u3002\u53ef\u4ee5\u901a\u8fc7pip\u5b89\u88c5Matplotlib\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">pip install matplotlib<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>4. \u5b89\u88c5Requests<\/h4>\n<\/p>\n<p><p>Requests\u662f\u4e00\u4e2a\u7b80\u5355\u6613\u7528\u7684HTTP\u5e93\uff0c\u53ef\u4ee5\u7528\u4e8e\u53d1\u9001HTTP\u8bf7\u6c42\u3002\u53ef\u4ee5\u901a\u8fc7pip\u5b89\u88c5Requests\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">pip install requests<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>5. \u5b89\u88c5Flask<\/h4>\n<\/p>\n<p><p>Flask\u662f\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u7684Web\u6846\u67b6\uff0c\u53ef\u4ee5\u7528\u4e8e\u5feb\u901f\u5f00\u53d1Web\u5e94\u7528\u3002\u53ef\u4ee5\u901a\u8fc7pip\u5b89\u88c5Flask\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">pip install flask<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u516d\u3001\u914d\u7f6e\u865a\u62df\u73af\u5883<\/h3>\n<\/p>\n<p><p>\u5728\u5f00\u53d1Python\u9879\u76ee\u65f6\uff0c\u5efa\u8bae\u4f7f\u7528\u865a\u62df\u73af\u5883\u6765\u7ba1\u7406\u9879\u76ee\u7684\u4f9d\u8d56\u5e93\u3002\u865a\u62df\u73af\u5883\u53ef\u4ee5\u9694\u79bb\u9879\u76ee\u7684\u4f9d\u8d56\uff0c\u907f\u514d\u4e0d\u540c\u9879\u76ee\u4e4b\u95f4\u7684\u5e93\u7248\u672c\u51b2\u7a81\u3002<\/p>\n<\/p>\n<p><h4>1. \u521b\u5efa\u865a\u62df\u73af\u5883<\/h4>\n<\/p>\n<p><p>\u53ef\u4ee5\u4f7f\u7528<code>venv<\/code>\u6a21\u5757\u521b\u5efa\u865a\u62df\u73af\u5883\u3002\u9996\u5148\uff0c\u8fdb\u5165\u9879\u76ee\u76ee\u5f55\uff0c\u7136\u540e\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">python -m venv myenv<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5176\u4e2d<code>myenv<\/code>\u662f\u865a\u62df\u73af\u5883\u7684\u540d\u79f0\uff0c\u53ef\u4ee5\u6839\u636e\u9700\u8981\u66f4\u6539\u3002<\/p>\n<\/p>\n<p><h4>2. \u6fc0\u6d3b\u865a\u62df\u73af\u5883<\/h4>\n<\/p>\n<p><p>\u5728Windows\u4e0a\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6fc0\u6d3b\u865a\u62df\u73af\u5883\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">myenv\\Scripts\\activate<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u6fc0\u6d3b\u540e\uff0c\u547d\u4ee4\u63d0\u793a\u7b26\u4f1a\u663e\u793a\u865a\u62df\u73af\u5883\u7684\u540d\u79f0\uff0c\u8868\u793a\u865a\u62df\u73af\u5883\u5df2\u7ecf\u6fc0\u6d3b\u3002<\/p>\n<\/p>\n<p><h4>3. \u5728\u865a\u62df\u73af\u5883\u4e2d\u5b89\u88c5\u5e93<\/h4>\n<\/p>\n<p><p>\u6fc0\u6d3b\u865a\u62df\u73af\u5883\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528pip\u5b89\u88c5\u9879\u76ee\u6240\u9700\u7684\u5e93\u3002\u4f8b\u5982\uff0c\u5b89\u88c5Django\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">pip install django<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>4. \u9000\u51fa\u865a\u62df\u73af\u5883<\/h4>\n<\/p>\n<p><p>\u5b8c\u6210\u5f00\u53d1\u5de5\u4f5c\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u9000\u51fa\u865a\u62df\u73af\u5883\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">deactivate<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e03\u3001\u4f7f\u7528Python IDE<\/h3>\n<\/p>\n<p><p>\u4e3a\u4e86\u63d0\u9ad8\u5f00\u53d1\u6548\u7387\uff0c\u5efa\u8bae\u4f7f\u7528\u96c6\u6210\u5f00\u53d1\u73af\u5883\uff08IDE\uff09\u8fdb\u884cPython\u5f00\u53d1\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u7528\u7684Python IDE\uff1a<\/p>\n<\/p>\n<p><h4>1. PyCharm<\/h4>\n<\/p>\n<p><p>PyCharm\u662f\u4e00\u4e2a\u4e13\u4e1a\u7684Python IDE\uff0c\u63d0\u4f9b\u4e86\u5f3a\u5927\u7684\u4ee3\u7801\u7f16\u8f91\u3001\u8c03\u8bd5\u548c\u6d4b\u8bd5\u529f\u80fd\u3002\u53ef\u4ee5\u4ecePyCharm\u5b98\u65b9\u7f51\u7ad9\uff08<a href=\"https:\/\/www.jetbrains.com\/pycharm\/%EF%BC%89%E4%B8%8B%E8%BD%BD%E5%B9%B6%E5%AE%89%E8%A3%85%E3%80%82\">https:\/\/www.jetbr<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>ns.com\/pycharm\/\uff09\u4e0b\u8f7d\u5e76\u5b89\u88c5\u3002<\/a><\/p>\n<\/p>\n<p><h4>2. Visual Studio Code<\/h4>\n<\/p>\n<p><p>Visual Studio Code\uff08VSCode\uff09\u662f\u4e00\u4e2a\u8f7b\u91cf\u7ea7\u7684\u4ee3\u7801\u7f16\u8f91\u5668\uff0c\u652f\u6301\u591a\u79cd\u7f16\u7a0b\u8bed\u8a00\u3002\u53ef\u4ee5\u901a\u8fc7\u5b89\u88c5Python\u6269\u5c55\u6765\u652f\u6301Python\u5f00\u53d1\u3002\u53ef\u4ee5\u4eceVSCode\u5b98\u65b9\u7f51\u7ad9\uff08<a href=\"https:\/\/code.visualstudio.com\/%EF%BC%89%E4%B8%8B%E8%BD%BD%E5%B9%B6%E5%AE%89%E8%A3%85%E3%80%82\">https:\/\/code.visualstudio.com\/\uff09\u4e0b\u8f7d\u5e76\u5b89\u88c5\u3002<\/a><\/p>\n<\/p>\n<p><h4>3. Jupyter Notebook<\/h4>\n<\/p>\n<p><p>Jupyter Notebook\u662f\u4e00\u4e2a\u4ea4\u4e92\u5f0f\u7684Web\u5e94\u7528\uff0c\u53ef\u4ee5\u7528\u4e8e\u521b\u5efa\u548c\u5206\u4eab\u5305\u542b\u4ee3\u7801\u3001\u6587\u672c\u3001\u516c\u5f0f\u548c\u56fe\u8868\u7684\u6587\u6863\u3002\u53ef\u4ee5\u901a\u8fc7pip\u5b89\u88c5Jupyter Notebook\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">pip install notebook<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u542f\u52a8Jupyter Notebook\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">jupyter notebook<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u516b\u3001\u8c03\u8bd5\u548c\u6d4b\u8bd5<\/h3>\n<\/p>\n<p><p>\u5728\u5f00\u53d1\u8fc7\u7a0b\u4e2d\uff0c\u8c03\u8bd5\u548c\u6d4b\u8bd5\u662f\u5fc5\u4e0d\u53ef\u5c11\u7684\u73af\u8282\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u8c03\u8bd5\u548c\u6d4b\u8bd5\u5de5\u5177\u53ca\u5176\u4f7f\u7528\u65b9\u6cd5\u3002<\/p>\n<\/p>\n<p><h4>1. \u4f7f\u7528\u8c03\u8bd5\u5668<\/h4>\n<\/p>\n<p><p>PyCharm\u548cVSCode\u90fd\u5185\u7f6e\u4e86\u5f3a\u5927\u7684\u8c03\u8bd5\u5668\uff0c\u53ef\u4ee5\u8bbe\u7f6e\u65ad\u70b9\u3001\u5355\u6b65\u6267\u884c\u4ee3\u7801\u3001\u67e5\u770b\u53d8\u91cf\u503c\u7b49\u3002\u4ee5\u4e0b\u662fPyCharm\u548cVSCode\u8c03\u8bd5Python\u4ee3\u7801\u7684\u7b80\u8981\u6b65\u9aa4\u3002<\/p>\n<\/p>\n<p><p><strong>PyCharm:<\/strong><\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00PyCharm\uff0c\u521b\u5efa\u6216\u6253\u5f00\u4e00\u4e2aPython\u9879\u76ee\u3002<\/li>\n<li>\u5728\u4ee3\u7801\u884c\u53f7\u5904\u70b9\u51fb\uff0c\u8bbe\u7f6e\u65ad\u70b9\u3002<\/li>\n<li>\u70b9\u51fb\u5de5\u5177\u680f\u4e2d\u7684\u8c03\u8bd5\u6309\u94ae\uff0c\u542f\u52a8\u8c03\u8bd5\u6a21\u5f0f\u3002<\/li>\n<li>\u8c03\u8bd5\u5668\u4f1a\u5728\u65ad\u70b9\u5904\u6682\u505c\uff0c\u53ef\u4ee5\u67e5\u770b\u53d8\u91cf\u503c\u3001\u6267\u884c\u5355\u6b65\u64cd\u4f5c\u7b49\u3002<\/li>\n<\/ol>\n<p><p><strong>VSCode:<\/strong><\/p>\n<\/p>\n<ol>\n<li>\u6253\u5f00VSCode\uff0c\u5b89\u88c5Python\u6269\u5c55\u3002<\/li>\n<li>\u521b\u5efa\u6216\u6253\u5f00\u4e00\u4e2aPython\u9879\u76ee\u3002<\/li>\n<li>\u5728\u4ee3\u7801\u884c\u53f7\u5904\u70b9\u51fb\uff0c\u8bbe\u7f6e\u65ad\u70b9\u3002<\/li>\n<li>\u6309F5\u6216\u70b9\u51fb\u5de6\u4fa7\u8c03\u8bd5\u56fe\u6807\uff0c\u542f\u52a8\u8c03\u8bd5\u6a21\u5f0f\u3002<\/li>\n<li>\u8c03\u8bd5\u5668\u4f1a\u5728\u65ad\u70b9\u5904\u6682\u505c\uff0c\u53ef\u4ee5\u67e5\u770b\u53d8\u91cf\u503c\u3001\u6267\u884c\u5355\u6b65\u64cd\u4f5c\u7b49\u3002<\/li>\n<\/ol>\n<p><h4>2. \u7f16\u5199\u5355\u5143\u6d4b\u8bd5<\/h4>\n<\/p>\n<p><p>\u5355\u5143\u6d4b\u8bd5\u662f\u6d4b\u8bd5\u4ee3\u7801\u6700\u5c0f\u5355\u5143\u7684\u6d4b\u8bd5\u65b9\u6cd5\uff0c\u53ef\u4ee5\u786e\u4fdd\u4ee3\u7801\u7684\u6b63\u786e\u6027\u3002Python\u5185\u7f6e\u4e86<code>unittest<\/code>\u6a21\u5757\uff0c\u53ef\u4ee5\u7528\u4e8e\u7f16\u5199\u548c\u8fd0\u884c\u5355\u5143\u6d4b\u8bd5\u3002<\/p>\n<\/p>\n<p><p><strong>\u793a\u4f8b\uff1a<\/strong><\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import unittest<\/p>\n<p>def add(a, b):<\/p>\n<p>    return a + b<\/p>\n<p>class TestMath(unittest.TestCase):<\/p>\n<p>    def test_add(self):<\/p>\n<p>        self.assertEqual(add(1, 2), 3)<\/p>\n<p>        self.assertEqual(add(-1, 1), 0)<\/p>\n<p>        self.assertEqual(add(-1, -1), -2)<\/p>\n<p>if __name__ == &#39;__main__&#39;:<\/p>\n<p>    unittest.main()<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p>\u8fd0\u884c\u4e0a\u8ff0\u4ee3\u7801\uff0c\u53ef\u4ee5\u770b\u5230\u5355\u5143\u6d4b\u8bd5\u7684\u7ed3\u679c\u3002\u5982\u679c\u6709\u6d4b\u8bd5\u672a\u901a\u8fc7\uff0c<code>unittest<\/code>\u4f1a\u63d0\u4f9b\u8be6\u7ec6\u7684\u9519\u8bef\u4fe1\u606f\uff0c\u5e2e\u52a9\u5b9a\u4f4d\u95ee\u9898\u3002<\/p>\n<\/p>\n<p><h4>3. \u4f7f\u7528\u6d4b\u8bd5\u6846\u67b6<\/h4>\n<\/p>\n<p><p>\u9664\u4e86<code>unittest<\/code>\uff0c\u8fd8\u6709\u8bb8\u591a\u7b2c\u4e09\u65b9\u6d4b\u8bd5\u6846\u67b6\uff0c\u5982<code>pytest<\/code>\u3001<code>nose<\/code>\u7b49\uff0c\u53ef\u4ee5\u7b80\u5316\u6d4b\u8bd5\u7f16\u5199\u548c\u8fd0\u884c\u8fc7\u7a0b\u3002<\/p>\n<\/p>\n<p><p><strong>\u5b89\u88c5pytest:<\/strong><\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">pip install pytest<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u7f16\u5199pytest\u6d4b\u8bd5\uff1a<\/strong><\/p>\n<\/p>\n<p><pre><code class=\"language-python\">def add(a, b):<\/p>\n<p>    return a + b<\/p>\n<p>def test_add():<\/p>\n<p>    assert add(1, 2) == 3<\/p>\n<p>    assert add(-1, 1) == 0<\/p>\n<p>    assert add(-1, -1) == -2<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u8fd0\u884cpytest\u6d4b\u8bd5\uff1a<\/strong><\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">pytest<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e5d\u3001\u6253\u5305\u548c\u53d1\u5e03Python\u9879\u76ee<\/h3>\n<\/p>\n<p><p>\u5f53\u5f00\u53d1\u5b8c\u6210\u4e00\u4e2aPython\u9879\u76ee\u540e\uff0c\u53ef\u4ee5\u5c06\u5176\u6253\u5305\u5e76\u53d1\u5e03\uff0c\u4ee5\u4fbf\u5176\u4ed6\u4eba\u4f7f\u7528\u3002\u4ee5\u4e0b\u662f\u6253\u5305\u548c\u53d1\u5e03Python\u9879\u76ee\u7684\u57fa\u672c\u6b65\u9aa4\u3002<\/p>\n<\/p>\n<p><h4>1. \u521b\u5efa<code>setup.py<\/code>\u6587\u4ef6<\/h4>\n<\/p>\n<p><p>\u5728\u9879\u76ee\u6839\u76ee\u5f55\u4e0b\u521b\u5efa\u4e00\u4e2a<code>setup.py<\/code>\u6587\u4ef6\uff0c\u5b9a\u4e49\u9879\u76ee\u7684\u5143\u6570\u636e\u548c\u4f9d\u8d56\u9879\u3002<\/p>\n<\/p>\n<p><p><strong>\u793a\u4f8b\uff1a<\/strong><\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from setuptools import setup, find_packages<\/p>\n<p>setup(<\/p>\n<p>    name=&#39;myproject&#39;,<\/p>\n<p>    version=&#39;0.1.0&#39;,<\/p>\n<p>    packages=find_packages(),<\/p>\n<p>    install_requires=[<\/p>\n<p>        &#39;numpy&#39;,<\/p>\n<p>        &#39;pandas&#39;,<\/p>\n<p>    ],<\/p>\n<p>    entry_points={<\/p>\n<p>        &#39;console_scripts&#39;: [<\/p>\n<p>            &#39;myproject=myproject.main:main&#39;,<\/p>\n<p>        ],<\/p>\n<p>    },<\/p>\n<p>)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u6253\u5305\u9879\u76ee<\/h4>\n<\/p>\n<p><p>\u4f7f\u7528<code>setuptools<\/code>\u6253\u5305\u9879\u76ee\uff0c\u53ef\u4ee5\u751f\u6210\u5206\u53d1\u5305\u548c\u5b89\u88c5\u5305\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">python setup.py sdist bdist_wheel<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3. \u53d1\u5e03\u9879\u76ee<\/h4>\n<\/p>\n<p><p>\u53ef\u4ee5\u5c06\u6253\u5305\u597d\u7684\u9879\u76ee\u53d1\u5e03\u5230Python\u5305\u7d22\u5f15\uff08PyPI\uff09\u4e0a\uff0c\u4f9b\u5176\u4ed6\u4eba\u4e0b\u8f7d\u548c\u5b89\u88c5\u3002<\/p>\n<\/p>\n<p><p><strong>\u5b89\u88c5<code>twine<\/code>\uff1a<\/strong><\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">pip install twine<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><p><strong>\u4e0a\u4f20\u5305\u5230PyPI\uff1a<\/strong><\/p>\n<\/p>\n<p><pre><code class=\"language-sh\">twine upload dist\/*<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u5341\u3001\u5b66\u4e60\u548c\u63d0\u5347<\/h3>\n<\/p>\n<p><p>\u5b66\u4e60Python\u662f\u4e00\u4e2a\u6301\u7eed\u7684\u8fc7\u7a0b\uff0c\u5efa\u8bae\u591a\u9605\u8bfb\u5b98\u65b9\u6587\u6863\u3001\u53c2\u8003\u4e66\u7c4d\u548c\u5728\u7ebf\u6559\u7a0b\uff0c\u5e76\u53c2\u4e0e\u5b9e\u9645\u9879\u76ee\uff0c\u4e0d\u65ad\u63d0\u5347\u81ea\u5df1\u7684\u7f16\u7a0b\u6c34\u5e73\u3002<\/p>\n<\/p>\n<p><h4>1. \u5b98\u65b9\u6587\u6863<\/h4>\n<\/p>\n<p><p>Python\u5b98\u65b9\u6587\u6863\uff08<a href=\"https:\/\/docs.python.org\/3\/%EF%BC%89%E6%98%AF%E5%AD%A6%E4%B9%A0Python%E7%9A%84%E6%9D%83%E5%A8%81%E8%B5%84%E6%BA%90%EF%BC%8C%E5%8C%85%E5%90%AB%E4%BA%86%E8%AF%A6%E7%BB%86%E7%9A%84%E8%AF%AD%E8%A8%80%E5%8F%82%E8%80%83%E3%80%81%E6%A0%87%E5%87%86%E5%BA%93%E5%92%8C%E7%A4%BA%E4%BE%8B%E4%BB%A3%E7%A0%81%E3%80%82\">https:\/\/docs.python.org\/3\/\uff09\u662f\u5b66\u4e60Python\u7684\u6743\u5a01\u8d44\u6e90\uff0c\u5305\u542b\u4e86\u8be6\u7ec6\u7684\u8bed\u8a00\u53c2\u8003\u3001\u6807\u51c6\u5e93\u548c\u793a\u4f8b\u4ee3\u7801\u3002<\/a><\/p>\n<\/p>\n<p><h4>2. \u53c2\u8003\u4e66\u7c4d<\/h4>\n<\/p>\n<p><p>\u4ee5\u4e0b\u662f\u4e00\u4e9b\u63a8\u8350\u7684Python\u53c2\u8003\u4e66\u7c4d\uff1a<\/p>\n<\/p>\n<ul>\n<li>\u300aPython\u7f16\u7a0b\uff1a\u4ece\u5165\u95e8\u5230\u5b9e\u8df5\u300b &#8211; \u9002\u5408\u521d\u5b66\u8005\uff0c\u6db5\u76d6\u57fa\u7840\u77e5\u8bc6\u548c\u9879\u76ee\u5b9e\u6218\u3002<\/li>\n<li>\u300a\u6d41\u7545\u7684Python\u300b &#8211; \u9002\u5408\u6709\u4e00\u5b9a\u57fa\u7840\u7684\u5f00\u53d1\u8005\uff0c\u6df1\u5165\u63a2\u8ba8Python\u9ad8\u7ea7\u7279\u6027\u3002<\/li>\n<li>\u300aPython Cookbook\u300b &#8211; \u9002\u5408\u6709\u4e00\u5b9a\u7ecf\u9a8c\u7684\u5f00\u53d1\u8005\uff0c\u63d0\u4f9b\u4e86\u4e30\u5bcc\u7684\u4ee3\u7801\u793a\u4f8b\u548c\u89e3\u51b3\u65b9\u6848\u3002<\/li>\n<\/ul>\n<p><h4>3. \u5728\u7ebf\u6559\u7a0b<\/h4>\n<\/p>\n<p><p>\u4ee5\u4e0b\u662f\u4e00\u4e9b\u63a8\u8350\u7684\u5728\u7ebf\u6559\u7a0b\u548c\u5b66\u4e60\u8d44\u6e90\uff1a<\/p>\n<\/p>\n<ul>\n<li>Codecademy\uff08<a href=\"https:\/\/www.codecademy.com\/%EF%BC%89\">https:\/\/www.codecademy.com\/\uff09<\/a> &#8211; \u63d0\u4f9b\u4ea4\u4e92\u5f0f\u7684Python\u8bfe\u7a0b\u3002<\/li>\n<li>Coursera\uff08<a href=\"https:\/\/www.coursera.org\/%EF%BC%89\">https:\/\/www.coursera.org\/\uff09<\/a> &#8211; \u63d0\u4f9b\u591a\u79cdPython\u8bfe\u7a0b\uff0c\u7531\u77e5\u540d\u5927\u5b66\u548c\u673a\u6784\u6388\u8bfe\u3002<\/li>\n<li>Real Python\uff08<a href=\"https:\/\/realpython.com\/%EF%BC%89\">https:\/\/realpython.com\/\uff09<\/a> &#8211; \u63d0\u4f9b\u4e30\u5bcc\u7684Python\u6559\u7a0b\u548c\u9879\u76ee\u5b9e\u6218\u3002<\/li>\n<\/ul>\n<p><p>\u901a\u8fc7\u4e0d\u65ad\u5b66\u4e60\u548c\u5b9e\u8df5\uff0c\u76f8\u4fe1\u60a8\u80fd\u591f\u5728Python\u7f16\u7a0b\u7684\u9053\u8def\u4e0a\u53d6\u5f97\u957f\u8db3\u7684\u8fdb\u6b65\uff0c\u5e76\u80fd\u591f\u80dc\u4efb\u5404\u79cd\u5f00\u53d1\u4efb\u52a1\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u786e\u8ba4\u6211\u7684Windows 7\u7cfb\u7edf\u662f\u5426\u652f\u6301Python\u7684\u6700\u65b0\u7248\u672c\uff1f<\/strong><br \/>\u5728\u5b89\u88c5Python\u4e4b\u524d\uff0c\u786e\u4fdd\u4f60\u7684Windows 7\u7cfb\u7edf\u66f4\u65b0\u5230\u6700\u65b0\u7684Service Pack\uff08\u901a\u5e38\u662fSP1\uff09\uff0c\u56e0\u4e3a\u67d0\u4e9b\u8f83\u65b0\u7248\u672c\u7684Python\u53ef\u80fd\u9700\u8981\u8f83\u9ad8\u7684\u7cfb\u7edf\u8981\u6c42\u3002\u6b64\u5916\uff0c\u8bbf\u95eePython\u7684\u5b98\u65b9\u7f51\u7ad9\uff0c\u67e5\u770b\u6bcf\u4e2a\u7248\u672c\u7684\u7cfb\u7edf\u8981\u6c42\uff0c\u4ee5\u786e\u4fdd\u517c\u5bb9\u6027\u3002<\/p>\n<p><strong>\u5728Windows 7\u4e0a\u5b89\u88c5Python\u65f6\u9700\u8981\u6ce8\u610f\u54ea\u4e9b\u9009\u9879\uff1f<\/strong><br \/>\u5b89\u88c5\u65f6\uff0c\u901a\u5e38\u4f1a\u770b\u5230\u201cAdd Python to PATH\u201d\u7684\u9009\u9879\uff0c\u5efa\u8bae\u52fe\u9009\u8fd9\u4e2a\u9009\u9879\u3002\u8fd9\u6837\u53ef\u4ee5\u65b9\u4fbf\u5728\u547d\u4ee4\u884c\u4e2d\u76f4\u63a5\u4f7f\u7528Python\u3002\u6b64\u5916\uff0c\u9009\u62e9\u201cCustomize installation\u201d\u53ef\u4ee5\u8ba9\u4f60\u9009\u62e9\u662f\u5426\u5b89\u88c5pip\u7b49\u5176\u4ed6\u7ec4\u4ef6\uff0cpip\u662fPython\u7684\u5305\u7ba1\u7406\u5de5\u5177\uff0c\u901a\u5e38\u63a8\u8350\u4e00\u8d77\u5b89\u88c5\u3002<\/p>\n<p><strong>\u5982\u4f55\u9a8c\u8bc1Python\u662f\u5426\u6210\u529f\u5b89\u88c5\u5728\u6211\u7684Windows 7\u4e0a\uff1f<\/strong><br \/>\u5b89\u88c5\u5b8c\u6210\u540e\uff0c\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff08CMD\uff09\uff0c\u8f93\u5165<code>python --version<\/code>\u6216<code>python -V<\/code>\uff0c\u5982\u679c\u663e\u793a\u51fa\u7248\u672c\u53f7\uff0c\u5219\u8bf4\u660e\u5b89\u88c5\u6210\u529f\u3002\u4f60\u4e5f\u53ef\u4ee5\u8f93\u5165<code>pip --version<\/code>\u6765\u786e\u8ba4pip\u662f\u5426\u6b63\u5e38\u5de5\u4f5c\uff0c\u8fd9\u5bf9\u4e8e\u540e\u7eed\u5b89\u88c5Python\u5e93\u975e\u5e38\u91cd\u8981\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5982\u4f55\u5728win7\u4e0a\u5b89\u88c5python \u5728Windows 7\u4e0a\u5b89\u88c5Python\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u51e0\u4e2a\u6b65\u9aa4\u6765\u5b8c\u6210\uff1a\u4e0b\u8f7dPyt [&hellip;]","protected":false},"author":3,"featured_media":1085654,"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\/1085637"}],"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=1085637"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1085637\/revisions"}],"predecessor-version":[{"id":1085655,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1085637\/revisions\/1085655"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1085654"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1085637"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1085637"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1085637"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}