一、问题
在 Matter SDK 通过运行激活脚本开始构建环境部署 source scripts/activate.sh
时,出现
Getting requirements to build wheel: started
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
Getting requirements to build wheel: finished with status 'error'
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip.
['/home/leung/Desktop/connectedhomeip/.environment/pigweed-venv/bin/python', '-m', 'pip', 'install', '--log', '/home/leung/Desktop/connectedhomeip/.environment/pigweed-venv/pip-requirements.log', '--requirement=/home/leung/Desktop/connectedhomeip/scripts/requirements.txt', '--constraint=/home/leung/Desktop/connectedhomeip/scripts/constraints.txt'] {'stdout': <_io.TextIOWrapper name=3 mode='w+' encoding='UTF-8'>, 'stderr': -2}
百度说有可能是 python3.10 的 pip 有问题,于是需要回退到 python3.8 版本。
二、解决方法
2.1 更改源更新apt
- 更改源:戳我查看教程
- 更新软件:
sudo apt-get update
sudo apt-get upgrade
2.2 安装编译依赖
sudo apt-get -y build-dep python3 && sudo apt-get install -y pkg-config
sudo apt-get install -y build-essential gdb lcov pkg-config \
libbz2-dev libffi-dev libgdbm-dev libgdbm-compat-dev liblzma-dev \
libncurses5-dev libreadline6-dev libsqlite3-dev libssl-dev \
lzma lzma-dev tk-dev uuid-dev zlib1g-dev
2.3 下载解压源码
cd /usr/local
sudo mkdir Python3
cd Python3
sudo wget https://www.python.org/ftp/python/3.8.10/Python-3.8.10.tgz
tar -xzf Python-3.8.10.tgz && cd Python-3.8.10/
2.4 编译及安装
sudo ./configure -with-ssl prefix=/usr/local/Python3/
sudo make
sudo make install
2.5 软连接python3.8和pip3
mv /usr/bin/python3 /usr/bin/python3.bak && ln -s /usr/local/Python3/bin/python3.8 /usr/bin/python3
mv /usr/bin/pip3 /usr/bin/pip3.bak && ln -s /usr/local/Python3/bin/pip3 /usr/bin/pip3
2.6 添加环境变量
vim ~/.zshrc
然后在文件末尾添加
export PATH=/usr/local/Python3/bin:$PATH
按ESC,输入:wq回车退出
source ~/.zshrc
2.7 升级pip和库
pip3 install --upgrade pip
pip3 install --upgrade setuptools
如果报错,先执行
sudo rm /usr/bin/lsb_release
• 由 Leung 写于 2023 年 8 月 23 日