{"id":204,"date":"2025-04-17T15:10:09","date_gmt":"2025-04-17T07:10:09","guid":{"rendered":"https:\/\/pc.wuhanioe.com\/index.php\/2025\/04\/17\/%e5%91%bd%e4%bb%a4%e6%89%be%e4%b8%8d%e5%88%b0%ef%bc%9fpath-%e7%8e%af%e5%a2%83%e5%8f%98%e9%87%8f%e9%94%99%e9%85%8d%e7%9a%84%e8%af%86%e5%88%ab%e4%b8%8e%e4%bf%ae%e5%a4%8d%e5%85%a8%e6%b5%81%e7%a8%8b\/"},"modified":"2025-04-17T15:10:09","modified_gmt":"2025-04-17T07:10:09","slug":"%e5%91%bd%e4%bb%a4%e6%89%be%e4%b8%8d%e5%88%b0%ef%bc%9fpath-%e7%8e%af%e5%a2%83%e5%8f%98%e9%87%8f%e9%94%99%e9%85%8d%e7%9a%84%e8%af%86%e5%88%ab%e4%b8%8e%e4%bf%ae%e5%a4%8d%e5%85%a8%e6%b5%81%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/pc.wuhanioe.com\/index.php\/2025\/04\/17\/%e5%91%bd%e4%bb%a4%e6%89%be%e4%b8%8d%e5%88%b0%ef%bc%9fpath-%e7%8e%af%e5%a2%83%e5%8f%98%e9%87%8f%e9%94%99%e9%85%8d%e7%9a%84%e8%af%86%e5%88%ab%e4%b8%8e%e4%bf%ae%e5%a4%8d%e5%85%a8%e6%b5%81%e7%a8%8b\/","title":{"rendered":"\u547d\u4ee4\u627e\u4e0d\u5230\uff1fPATH \u73af\u5883\u53d8\u91cf\u9519\u914d\u7684\u8bc6\u522b\u4e0e\u4fee\u590d\u5168\u6d41\u7a0b"},"content":{"rendered":"<p>\u300epython \u4e0d\u662f\u5185\u90e8\u6216\u5916\u90e8\u547d\u4ee4\u300f\u300enode command not found\u300f\u2014\u2014\u8fd9\u7c7b\u62a5\u9519\u51e0\u4e4e\u6bcf\u4e2a\u5f00\u53d1\u8005\u90fd\u89c1\u8fc7\u3002\u6839\u56e0\u901a\u5e38\u662f PATH \u73af\u5883\u53d8\u91cf\u6ca1\u5305\u542b\u7a0b\u5e8f\u7684\u53ef\u6267\u884c\u76ee\u5f55\uff0c\u6216\u88ab\u4eba\u8bef\u6539\u574f\u4e86\u3002PATH \u662f\u547d\u4ee4\u884c\u67e5\u627e\u7a0b\u5e8f\u7684\u5730\u56fe\uff0c\u5730\u56fe\u9519\u4e86\u81ea\u7136\u627e\u4e0d\u5230\u8def\u3002\u4e0b\u9762\u7cfb\u7edf\u4fee\u590d\u3002<\/p>\n<h2>\u4e00\u3001\u786e\u8ba4\u95ee\u9898\u786e\u5b9e\u51fa\u5728 PATH<\/h2>\n<p><strong>\u5148\u9a8c\u8bc1\u7a0b\u5e8f\u672c\u8eab\u662f\u5426\u8fd8\u5728\uff0c\u907f\u514d\u51a4\u6789 PATH<\/strong>\uff1a<\/p>\n<ol>\n<li>\u76f4\u63a5\u53bb\u5b89\u88c5\u76ee\u5f55\u53cc\u51fb exe\uff0c\u4f8b\u5982 <code>C:\\Python311\\python.exe<\/code>\uff0c\u80fd\u8fd0\u884c\u8bf4\u660e\u7a0b\u5e8f\u6ca1\u95ee\u9898\u3002<\/li>\n<li>\u547d\u4ee4\u884c\u6267\u884c <code>echo %PATH%<\/code>\uff08Windows\uff09\u6216 <code>echo $PATH<\/code>\uff08Linux\/macOS\uff09\uff0c\u770b\u662f\u5426\u542b\u8be5\u76ee\u5f55\u3002<\/li>\n<\/ol>\n<h2>\u4e8c\u3001Windows \u4e0b\u56fe\u5f62\u5316\u4fee\u590d PATH<\/h2>\n<ol>\n<li>\u300e\u6b64\u7535\u8111\u300f\u53f3\u952e \u2192 \u5c5e\u6027 \u2192 \u9ad8\u7ea7\u7cfb\u7edf\u8bbe\u7f6e \u2192 \u73af\u5883\u53d8\u91cf\u3002<\/li>\n<li>\u5728\u7cfb\u7edf\u53d8\u91cf\uff08\u5bf9\u6240\u6709\u7528\u6237\uff09\u6216\u7528\u6237\u53d8\u91cf\u91cc\u627e\u5230 <code>Path<\/code>\uff0c\u53cc\u51fb\u7f16\u8f91\u3002<\/li>\n<li>\u70b9\u300e\u65b0\u5efa\u300f\uff0c\u586b\u5165\u7a0b\u5e8f bin \u76ee\u5f55\uff0c\u5982 <code>C:\\Python311\\<\/code> \u6216 <code>C:\\Program Files\\nodejs\\<\/code>\u3002<\/li>\n<li>\u52a1\u5fc5\u4e0a\u79fb\u5230\u9760\u524d\uff0c\u907f\u514d\u88ab\u540c\u540d\u65e7\u8def\u5f84\u8986\u76d6\uff1b\u786e\u5b9a\u540e\u91cd\u5f00\u547d\u4ee4\u884c\u751f\u6548\u3002<\/li>\n<\/ol>\n<h2>\u4e09\u3001\u547d\u4ee4\u884c\u5feb\u901f\u4fee\u590d\uff08Windows\uff09<\/h2>\n<p><strong>\u53ef\u7528 setx \u4e00\u6b21\u6027\u5199\u5165\uff0c\u4f46\u6ce8\u610f\u5b83\u4f1a\u8986\u76d6\u6574\u6761 Path<\/strong>\uff0c\u5efa\u8bae\u5148\u5907\u4efd\uff1a<\/p>\n<ol>\n<li><code>set PATH_BACKUP=%PATH%<\/code> \u8bb0\u4e0b\u539f\u503c\u3002<\/li>\n<li><code>setx PATH \"%PATH%;C:\\Python311\\\"<\/code> \u8ffd\u52a0\u65b0\u76ee\u5f55\u3002<\/li>\n<li>\u66f4\u7a33\u59a5\u662f\u56fe\u5f62\u754c\u9762\u7f16\u8f91\uff0c\u907f\u514d\u8bef\u5220\u5df2\u6709\u6761\u76ee\u3002<\/li>\n<\/ol>\n<h2>\u56db\u3001Linux\/macOS \u7684 shell \u914d\u7f6e<\/h2>\n<ol>\n<li>\u628a <code>export PATH=\"$PATH:\/opt\/node\/bin\"<\/code> \u5199\u5165 <code>~\/.bashrc<\/code> \u6216 <code>~\/.zshrc<\/code>\u3002<\/li>\n<li>\u6267\u884c <code>source ~\/.bashrc<\/code> \u7acb\u5373\u751f\u6548\uff0c\u518d\u7528 <code>which node<\/code> \u9a8c\u8bc1\u3002<\/li>\n<\/ol>\n<h2>\u4e94\u3001\u5e38\u89c1\u9677\u9631\u4e0e\u6392\u67e5<\/h2>\n<p>PATH \u91cc\u8def\u5f84\u5206\u9694\u7b26 Windows \u7528\u5206\u53f7\u3001Linux\/macOS \u7528\u5192\u53f7\uff0c<strong>\u6df7\u7528\u4f1a\u5bfc\u81f4\u6574\u6761\u5931\u6548<\/strong>\u3002\u53e6\u5916\uff0c\u7f16\u8f91\u540e\u5fc5\u987b\u65b0\u5f00\u7ec8\u7aef\u7a97\u53e3\uff0c\u65e7\u7a97\u53e3\u4e0d\u4f1a\u81ea\u52a8\u91cd\u8f7d\u3002\u82e5\u547d\u4ee4\u4ecd\u627e\u4e0d\u5230\uff0c\u7528 <code>where python<\/code> \u770b\u662f\u5426\u547d\u4e2d\u4e86\u9519\u8bef\u4f4d\u7f6e\u3002<\/p>\n<p><strong>\u6280\u672f\u5c0f\u7ed3\uff1a<\/strong>\u547d\u4ee4\u627e\u4e0d\u5230\u672c\u8d28\u662f PATH \u6ca1\u8986\u76d6\u53ef\u6267\u884c\u76ee\u5f55\u3002\u4fee\u590d\u987a\u5e8f\u662f\u300e\u786e\u8ba4\u7a0b\u5e8f\u5728 \u2192 \u68c0\u67e5 PATH \u5185\u5bb9 \u2192 \u56fe\u5f62\u6216 setx \u8ffd\u52a0\u76ee\u5f55 \u2192 \u91cd\u5f00\u7ec8\u7aef\u9a8c\u8bc1\u300f\u3002\u5207\u8bb0 Windows \u7528\u5206\u53f7\u5206\u9694\u3001\u6539\u5b8c\u8981\u5f00\u65b0\u7a97\u53e3\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u8bca\u65ad Path \u4e22\u5931\u4e0e\u9519\u5199\uff0c\u624b\u628a\u624b\u628a python\u3001node \u7b49\u547d\u4ee4\u91cd\u65b0\u52a0\u56de\u547d\u4ee4\u884c\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_kadence_starter_templates_imported_post":false,"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"footnotes":""},"categories":[3],"tags":[],"class_list":["post-204","post","type-post","status-publish","format-standard","hentry","category-3"],"_links":{"self":[{"href":"https:\/\/pc.wuhanioe.com\/index.php\/wp-json\/wp\/v2\/posts\/204","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pc.wuhanioe.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pc.wuhanioe.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pc.wuhanioe.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pc.wuhanioe.com\/index.php\/wp-json\/wp\/v2\/comments?post=204"}],"version-history":[{"count":0,"href":"https:\/\/pc.wuhanioe.com\/index.php\/wp-json\/wp\/v2\/posts\/204\/revisions"}],"wp:attachment":[{"href":"https:\/\/pc.wuhanioe.com\/index.php\/wp-json\/wp\/v2\/media?parent=204"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pc.wuhanioe.com\/index.php\/wp-json\/wp\/v2\/categories?post=204"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pc.wuhanioe.com\/index.php\/wp-json\/wp\/v2\/tags?post=204"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}