详情

Ubuntu16.4 额外安装 python3.9

pip3安装模块时报错:

File "/usr/local/lib/python3.9/subprocess.py", line 512, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned non-zero exit status 1.

原因:

python路径(/usr/local/lib/python3.9/)下缺少 'lsb_release.py' 模块

解决:

# 查找lsb_release.py所在的目录
sudo find / -name 'lsb_release.py'

# 复制lsb_release.py到所缺少模块的目录
sudo cp /usr/lib/python3/dist-packages/lsb_release.py /usr/local/lib/python3.9/

重新执行pip3 list,恢复正常。