{"id":16014,"date":"2024-11-18T09:10:20","date_gmt":"2024-11-18T01:10:20","guid":{"rendered":"https:\/\/fwq.ai\/blog\/16014\/"},"modified":"2024-11-18T09:10:20","modified_gmt":"2024-11-18T01:10:20","slug":"linux%e7%8e%af%e5%a2%83%e5%8f%98%e9%87%8fpath%e5%9c%a8%e5%93%aa","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/16014\/","title":{"rendered":"linux\u73af\u5883\u53d8\u91cfpath\u5728\u54ea"},"content":{"rendered":"<blockquote><p>\n  linux\u73af\u5883\u53d8\u91cfpath\u5b58\u50a8\u5728\u7528\u6237\u7684\u914d\u7f6e\u6587\u4ef6\u4e2d\uff0c\u901a\u5e38\u4f4d\u4e8e\u7528\u6237\u4e3b\u76ee\u5f55\u4e0b\u7684\u4e00\u4e2a\u9690\u85cf\u6587\u4ef6\uff0c\u540d\u4e3a\u201c.bashrc\u201d\u6216\u201c.bash_profile\u201d\uff0c\u8fd9\u4e9b\u6587\u4ef6\u5305\u542b\u4e86\u7528\u6237\u767b\u5f55\u65f6\u52a0\u8f7d\u7684\u73af\u5883\u53d8\u91cf\u548c\u5176\u4ed6\u914d\u7f6e\u4fe1\u606f\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202307\/05\/2023070517155226226.jpg\" class=\"aligncenter\" title=\"linux\u73af\u5883\u53d8\u91cfpath\u5728\u54ea\u63d2\u56fe\" alt=\"linux\u73af\u5883\u53d8\u91cfpath\u5728\u54ea\u63d2\u56fe\" \/><\/p>\n<p>\u672c\u6559\u7a0b\u64cd\u4f5c\u7cfb\u7edf\uff1aLinux5.18.14\u7cfb\u7edf\u3001Dell G3\u7535\u8111\u3002<\/p>\n<p><strong>\u5728 Linux \u7cfb\u7edf\u4e2d\uff0c\u73af\u5883\u53d8\u91cf&nbsp;PATH&nbsp;\u5b58\u50a8\u5728\u7528\u6237\u7684\u914d\u7f6e\u6587\u4ef6\u4e2d\u3002<\/strong>\u5177\u4f53\u6765\u8bf4\uff0c\u5b83\u901a\u5e38\u4f4d\u4e8e\u7528\u6237\u4e3b\u76ee\u5f55\u4e0b\u7684\u4e00\u4e2a\u9690\u85cf\u6587\u4ef6\uff0c\u540d\u4e3a&nbsp;.bashrc&nbsp;\u6216&nbsp;.bash_profile\u3002\u8fd9\u4e9b\u6587\u4ef6\u5305\u542b\u4e86\u7528\u6237\u767b\u5f55\u65f6\u52a0\u8f7d\u7684\u73af\u5883\u53d8\u91cf\u548c\u5176\u4ed6\u914d\u7f6e\u4fe1\u606f\u3002<\/p>\n<p>\u7528\u6237\u7684\u914d\u7f6e\u6587\u4ef6\u8def\u5f84\u5982\u4e0b\uff1a<\/p>\n<ul>\n<li>\n<p>\u5bf9\u4e8e\u666e\u901a\u7528\u6237\uff1a~\/.bashrc&nbsp;\u6216&nbsp;~\/.bash_profile<\/p>\n<\/li>\n<li>\n<p>\u5bf9\u4e8e root \u7528\u6237\uff1a\/root\/.bashrc&nbsp;\u6216&nbsp;\/root\/.bash_profile<\/p>\n<\/li>\n<\/ul>\n<p>\u53ef\u4ee5\u4f7f\u7528\u6587\u672c\u7f16\u8f91\u5668\uff08\u5982&nbsp;vi\u3001nano&nbsp;\u7b49\uff09\u6253\u5f00\u76f8\u5e94\u7684\u6587\u4ef6\uff0c\u67e5\u770b\u548c\u7f16\u8f91&nbsp;PATH&nbsp;\u73af\u5883\u53d8\u91cf\u3002\u793a\u4f8b\u547d\u4ee4\u5982\u4e0b\uff1a<\/p>\n<pre>vi&nbsp;~\/.bashrc<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5728\u6253\u5f00\u7684\u6587\u4ef6\u4e2d\uff0c\u4f60\u53ef\u4ee5\u627e\u5230\u7c7b\u4f3c\u4ee5\u4e0b\u7684\u884c\u6765\u8bbe\u7f6e&nbsp;PATH&nbsp;\u53d8\u91cf\uff1a<\/p>\n<pre>export&nbsp;PATH=\/usr\/local\/bin:\/usr\/bin:\/bin<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8fd9\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u793a\u4f8b\uff0c\u5c06\u4e09\u4e2a\u8def\u5f84&nbsp;\/usr\/local\/bin\u3001\/usr\/bin&nbsp;\u548c&nbsp;\/bin&nbsp;\u6dfb\u52a0\u5230&nbsp;PATH&nbsp;\u53d8\u91cf\u4e2d\u3002\u4f60\u53ef\u4ee5\u6309\u9700\u7f16\u8f91\u8be5\u884c\uff0c\u5c06\u9700\u8981\u7684\u8def\u5f84\u6dfb\u52a0\u5230&nbsp;PATH&nbsp;\u53d8\u91cf\u4e2d\uff0c\u7528\u5192\u53f7\u5206\u9694\u3002<\/p>\n<p>\u7f16\u8f91\u4fdd\u5b58\u540e\uff0c\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u4f7f\u4fee\u6539\u751f\u6548\uff1a<\/p>\n<pre>source&nbsp;~\/.bashrc<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u901a\u8fc7\u6267\u884c\u4e0a\u8ff0\u64cd\u4f5c\uff0c\u4f60\u53ef\u4ee5\u5728\u7528\u6237\u7684\u914d\u7f6e\u6587\u4ef6\u4e2d\u627e\u5230\u5e76\u4fee\u6539&nbsp;PATH&nbsp;\u73af\u5883\u53d8\u91cf\uff0c\u4ee5\u9002\u5e94\u4f60\u7684\u9700\u6c42\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662f\u73af\u5883\u53d8\u91cfpath\u5728\u54ea\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>linux\u73af\u5883\u53d8\u91cfpath\u5b58\u50a8\u5728\u7528\u6237\u7684\u914d\u7f6e\u6587\u4ef6\u4e2d\uff0c\u901a\u5e38\u4f4d\u4e8e\u7528\u6237\u4e3b\u76ee\u5f55\u4e0b\u7684\u4e00\u4e2a\u9690\u85cf\u6587\u4ef6\uff0c\u540d\u4e3a\u201c.bashrc\u201d\u6216\u201c.bash_profile\u201d\uff0c\u8fd9\u4e9b\u6587\u4ef6\u5305\u542b\u4e86\u7528\u6237\u767b\u5f55\u65f6\u52a0\u8f7d\u7684\u73af\u5883\u53d8\u91cf\u548c\u5176\u4ed6\u914d\u7f6e\u4fe1\u606f\u3002 \u672c\u6559\u7a0b\u64cd\u4f5c\u7cfb\u7edf\uff1aLinux5.18.14\u7cfb\u7edf\u3001Dell G3\u7535\u8111\u3002 \u5728 Linux \u7cfb\u7edf\u4e2d\uff0c\u73af\u5883\u53d8\u91cf&nbsp;PATH&nbsp;\u5b58\u50a8\u5728\u7528\u6237\u7684\u914d\u7f6e\u6587\u4ef6\u4e2d\u3002\u5177\u4f53\u6765\u8bf4\uff0c\u5b83\u901a\u5e38\u4f4d\u4e8e\u7528\u6237\u4e3b\u76ee\u5f55\u4e0b\u7684\u4e00\u4e2a\u9690\u85cf\u6587\u4ef6\uff0c\u540d\u4e3a&nbsp;.bashrc&nbsp;\u6216&nbsp;.bash_profile\u3002\u8fd9\u4e9b\u6587\u4ef6\u5305\u542b\u4e86\u7528\u6237\u767b\u5f55\u65f6\u52a0\u8f7d\u7684\u73af\u5883\u53d8\u91cf\u548c\u5176\u4ed6\u914d\u7f6e\u4fe1\u606f\u3002 \u7528\u6237\u7684\u914d\u7f6e\u6587\u4ef6\u8def\u5f84\u5982\u4e0b\uff1a \u5bf9\u4e8e\u666e\u901a\u7528\u6237\uff1a~\/.bashrc&nbsp;\u6216&nbsp;~\/.bash_profile \u5bf9\u4e8e root \u7528\u6237\uff1a\/root\/.bashrc&nbsp;\u6216&nbsp;\/root\/.bash_profile \u53ef\u4ee5\u4f7f\u7528\u6587\u672c\u7f16\u8f91\u5668\uff08\u5982&nbsp;vi\u3001nano&nbsp;\u7b49\uff09\u6253\u5f00\u76f8\u5e94\u7684\u6587\u4ef6\uff0c\u67e5\u770b\u548c\u7f16\u8f91&nbsp;PATH&nbsp;\u73af\u5883\u53d8\u91cf\u3002\u793a\u4f8b\u547d\u4ee4\u5982\u4e0b\uff1a vi&nbsp;~\/.bashrc \u767b\u5f55\u540e\u590d\u5236 \u5728\u6253\u5f00\u7684\u6587\u4ef6\u4e2d\uff0c\u4f60\u53ef\u4ee5\u627e\u5230\u7c7b\u4f3c\u4ee5\u4e0b\u7684\u884c\u6765\u8bbe\u7f6e&nbsp;PATH&nbsp;\u53d8\u91cf\uff1a export&nbsp;PATH=\/usr\/local\/bin:\/usr\/bin:\/bin \u767b\u5f55\u540e\u590d\u5236 \u8fd9\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u793a\u4f8b\uff0c\u5c06\u4e09\u4e2a\u8def\u5f84&nbsp;\/usr\/local\/bin\u3001\/usr\/bin&nbsp;\u548c&nbsp;\/bin&nbsp;\u6dfb\u52a0\u5230&nbsp;PATH&nbsp;\u53d8\u91cf\u4e2d\u3002\u4f60\u53ef\u4ee5\u6309\u9700\u7f16\u8f91\u8be5\u884c\uff0c\u5c06\u9700\u8981\u7684\u8def\u5f84\u6dfb\u52a0\u5230&nbsp;PATH&nbsp;\u53d8\u91cf\u4e2d\uff0c\u7528\u5192\u53f7\u5206\u9694\u3002 \u7f16\u8f91\u4fdd\u5b58\u540e\uff0c\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u4f7f\u4fee\u6539\u751f\u6548\uff1a source&nbsp;~\/.bashrc \u767b\u5f55\u540e\u590d\u5236 \u901a\u8fc7\u6267\u884c\u4e0a\u8ff0\u64cd\u4f5c\uff0c\u4f60\u53ef\u4ee5\u5728\u7528\u6237\u7684\u914d\u7f6e\u6587\u4ef6\u4e2d\u627e\u5230\u5e76\u4fee\u6539&nbsp;PATH&nbsp;\u73af\u5883\u53d8\u91cf\uff0c\u4ee5\u9002\u5e94\u4f60\u7684\u9700\u6c42\u3002 \u4ee5\u4e0a\u5c31\u662f\u73af\u5883\u53d8\u91cfpath\u5728\u54ea\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-16014","post","type-post","status-publish","format-standard","hentry","category-os"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/16014","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=16014"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/16014\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=16014"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=16014"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=16014"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}