M1 Mac pip3 install错误记录

M芯片mac pip install 错误记录

环境

  • M3芯片Mac
  • Python3.13.1
  • pip 24.3.1

场景

安装 nacos-sdk-python 时安装失败

bash 复制代码
% pip3 install nacos-sdk-python

error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try brew install
    xyz, where xyz is the package you are trying to
    install.
    
    If you wish to install a Python library that isn't in Homebrew,
    use a virtual environment:
    
    python3 -m venv path/to/venv
    source path/to/venv/bin/activate
    python3 -m pip install xyz
    
    If you wish to install a Python application that isn't in Homebrew,
    it may be easiest to use 'pipx install xyz', which will manage a
    virtual environment for you. You can install pipx with
    
    brew install pipx
    
    You may restore the old behavior of pip by passing
    the '--break-system-packages' flag to pip, or by adding
    'break-system-packages = true' to your pip.conf file. The latter
    will permanently disable this error.
    
    If you disable this error, we STRONGLY recommend that you additionally
    pass the '--user' flag to pip, or set 'user = true' in your pip.conf
    file. Failure to do this can result in a broken Homebrew installation.
    
    Read more about this behavior here: <https://peps.python.org/pep-0668/>

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 --break-system-packages.
hint: See PEP 668 for the detailed specification.
binsail@binsailpro demo % brew install

Xyz
==> Auto-updating Homebrew...
Adjust how often this is run with HOMEBREW_AUTO_UPDATE_SECS or disable with
HOMEBREW_NO_AUTO_UPDATE. Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).
^C^C

解决方案

bash 复制代码
cd /opt/homebrew/Cellar/python@3.13/3.13.1/Frameworks/Python.framework/Versions/3.13/lib/python3.13
mv EXTERNALLY-MANAGED EXTERNALLY-MANAGED-bak

重新安装

bash 复制代码
pip3 install nacos-sdk-python
相关推荐
又幸福了哥13 分钟前
Python入门到高级(知识点六)
python
维克兜率天16 分钟前
【维克】动量指标家族:RSI、ROC、CCI、Momentum全面解析
python·算法
XZ-0700011 小时前
week2-1-可视化
开发语言·python
Java后端的Ai之路1 小时前
14、Python - 责任链模式
服务器·开发语言·人工智能·python·责任链模式
张人玉1 小时前
基于 Python 机器学习 与 PyQt5 桌面框架开发的可视化分析系统——基于大数据的网上购物消费行为分析可视化大屏
python·qt·机器学习·echarts·three.js
一位正在转型AI全栈的前端工程师2 小时前
AI 全栈学习之旅 -Week 5:RAG 知识库问答系统:从零到生产级部署的全栈实践总结
前端·python
2601_962381862 小时前
Python办公联动:Excel数据一键自动生成PPT图表
python·数据分析·自动化·excel·ppt
东莞市永盛电气2 小时前
三相208V变380V变压器,出海工业设备供电适配方案
python·单片机·嵌入式硬件
未若君雅裁3 小时前
上下文压缩双刃剑-Summarization与ContextEditing中间件实战
python·中间件·langchain
IT毕设实战小研3 小时前
电影数据可视化推荐系统
大数据·后端·爬虫·python·算法·信息可视化·课程设计