{"id":42415,"date":"2025-06-08T15:27:50","date_gmt":"2025-06-08T07:27:50","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/42415.html"},"modified":"2025-06-08T15:27:50","modified_gmt":"2025-06-08T07:27:50","slug":"mac-python-%e5%ae%89%e8%a3%85%e4%be%9d%e8%b5%96%e5%87%ba%e9%94%99-error-externally-managed-environment","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/42415.html","title":{"rendered":"Mac Python \u5b89\u88c5\u4f9d\u8d56\u51fa\u9519 error: externally-managed-environment"},"content":{"rendered":"<p>Mac Python \u4f7f\u7528 ip3 install -r requirements.txt \u51fa\u9519<\/p>\n<p>\u00d7 This environment is externally managed<br \/>\n\u2570\u2500<span class=\"token operator\">&gt;<\/span> To <span class=\"token function\">install<\/span> Python packages system-wide, try brew <span class=\"token function\">install<\/span><br \/>\n    xyz, where xyz is the package you are trying to<br \/>\n    install.<\/p>\n<p>    If you wish to <span class=\"token function\">install<\/span> a Python library that isn<span class=\"token string\">&#039;t in Homebrew,<br \/>\n    use a virtual environment:<\/p>\n<p>    python3 -m venv path\/to\/venv<br \/>\n    source path\/to\/venv\/bin\/activate<br \/>\n    python3 -m pip install xyz<\/p>\n<p>    If you wish to install a Python application that isn&#039;<\/span>t <span class=\"token keyword\">in<\/span> Homebrew,<br \/>\n    it may be easiest to use <span class=\"token string\">&#039;pipx install xyz&#039;<\/span>, <span class=\"token function\">which<\/span> will manage a<br \/>\n    virtual environment <span class=\"token keyword\">for<\/span> you. You can <span class=\"token function\">install<\/span> pipx with<\/p>\n<p>    brew <span class=\"token function\">install<\/span> pipx<\/p>\n<p>    You may restore the old behavior of pip by passing<br \/>\n    the <span class=\"token string\">&#039;&#8211;break-system-packages&#039;<\/span> flag to pip, or by adding<br \/>\n    <span class=\"token string\">&#039;break-system-packages &#061; true&#039;<\/span> to your pip.conf file. The latter<br \/>\n    will permanently disable this error.<\/p>\n<p>    If you disable this error, we STRONGLY recommend that you additionally<br \/>\n    pass the <span class=\"token string\">&#039;&#8211;user&#039;<\/span> flag to pip, or <span class=\"token builtin class-name\">set<\/span> <span class=\"token string\">&#039;user &#061; true&#039;<\/span> <span class=\"token keyword\">in<\/span> your pip.conf<br \/>\n    file. Failure to <span class=\"token keyword\">do<\/span> this can result <span class=\"token keyword\">in<\/span> a broken Homebrew installation.<\/p>\n<p>    Read <span class=\"token function\">more<\/span> about this behavior here: <span class=\"token operator\">&lt;<\/span>https:\/\/peps.python.org\/pep-0668\/<span class=\"token operator\">&gt;<\/span><\/p>\n<p>note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing &#8211;break-system-packages.<br \/>\nhint: See PEP <span class=\"token number\">668<\/span> <span class=\"token keyword\">for<\/span> the detailed specification.<\/p>\n<p><span class=\"token punctuation\">[<\/span>notice<span class=\"token punctuation\">]<\/span> A new release of pip is available: <span class=\"token number\">24.0<\/span> &#8211;<span class=\"token operator\">&gt;<\/span> <span class=\"token number\">25.1<\/span>.1<br \/>\n<span class=\"token punctuation\">[<\/span>notice<span class=\"token punctuation\">]<\/span> To update, run: python3.12 <span class=\"token parameter variable\">-m<\/span> pip <span class=\"token function\">install<\/span> <span class=\"token parameter variable\">&#8211;upgrade<\/span> pip<\/p>\n<p>\u89e3\u51b3\u65b9\u6848&#xff1a;<\/p>\n<p>python3 <span class=\"token parameter variable\">-m<\/span> venv venv<br \/>\n<span class=\"token builtin class-name\">source<\/span> venv\/bin\/activate<\/p>\n<p>\u91cd\u65b0\u8fd0\u884c pip3 install -r requirements.txt<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1k\u6b21\u3002Mac Python \u4f7f\u7528 ip3 install -r requirements.txt \u51fa\u9519\u3002_to install python packages system-wide, try brew install xyz, where xyz is t<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[330,81,190,3944],"topic":[],"class_list":["post-42415","post","type-post","status-publish","format-standard","hentry","category-server","tag-macos","tag-python","tag-190","tag-3944"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Mac Python \u5b89\u88c5\u4f9d\u8d56\u51fa\u9519 error: externally-managed-environment - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/42415.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Mac Python \u5b89\u88c5\u4f9d\u8d56\u51fa\u9519 error: externally-managed-environment - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1k\u6b21\u3002Mac Python \u4f7f\u7528 ip3 install -r requirements.txt \u51fa\u9519\u3002_to install python packages system-wide, try brew install xyz, where xyz is t\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/42415.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2025-06-08T07:27:50+00:00\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/42415.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/42415.html\",\"name\":\"Mac Python \u5b89\u88c5\u4f9d\u8d56\u51fa\u9519 error: externally-managed-environment - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2025-06-08T07:27:50+00:00\",\"dateModified\":\"2025-06-08T07:27:50+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/42415.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/42415.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/42415.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Mac Python \u5b89\u88c5\u4f9d\u8d56\u51fa\u9519 error: externally-managed-environment\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Mac Python \u5b89\u88c5\u4f9d\u8d56\u51fa\u9519 error: externally-managed-environment - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/42415.html","og_locale":"zh_CN","og_type":"article","og_title":"Mac Python \u5b89\u88c5\u4f9d\u8d56\u51fa\u9519 error: externally-managed-environment - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u6d4f\u89c8\u9605\u8bfb1k\u6b21\u3002Mac Python \u4f7f\u7528 ip3 install -r requirements.txt \u51fa\u9519\u3002_to install python packages system-wide, try brew install xyz, where xyz is t","og_url":"https:\/\/www.wsisp.com\/helps\/42415.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2025-06-08T07:27:50+00:00","author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/42415.html","url":"https:\/\/www.wsisp.com\/helps\/42415.html","name":"Mac Python \u5b89\u88c5\u4f9d\u8d56\u51fa\u9519 error: externally-managed-environment - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2025-06-08T07:27:50+00:00","dateModified":"2025-06-08T07:27:50+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/42415.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/42415.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/42415.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Mac Python \u5b89\u88c5\u4f9d\u8d56\u51fa\u9519 error: externally-managed-environment"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/42415","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=42415"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/42415\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=42415"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=42415"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=42415"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=42415"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}