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
相关推荐
2301_81527952几秒前
golang如何编译iOS库_golang编译iOS库实践
jvm·数据库·python
MapleWan320631 分钟前
告别 AI IDE 配置碎片化:用 MSR-cli 打造你的本地 MCP / Rules / Skills 统一仓库
python·github
深蓝海拓1 分钟前
基于QtPy (PySide6) 的PLC-HMI工程项目(十一)框架的进一步完善:UI的自动周期更新以及下行数据的生成和处理
网络·笔记·python·学习·ui·plc
2402_854808372 分钟前
C#怎么开发CAD自定义命令_C#如何调用AutoCAD的API【教程】
jvm·数据库·python
m0_716430074 分钟前
mysql乐观锁更新失败如何处理_应用层重试逻辑编写建议
jvm·数据库·python
qq_654366985 分钟前
SQL嵌套查询中的变量传值_优化存储过程逻辑
jvm·数据库·python
m0_748920368 分钟前
持久化存储如何与后端接口同步?解决本地缓存与数据库不一致痛点
jvm·数据库·python
qq_330037999 分钟前
Python如何安装特定架构包_32位与64位系统兼容性处理
jvm·数据库·python
子午9 分钟前
蔬菜识别~Python+深度学习+卷积网络算法+图像识别+2026原创+蔬菜识别
python·深度学习·算法
测试19989 分钟前
软件测试之持续集成
自动化测试·软件测试·python·功能测试·测试工具·测试用例·持续集成