ubuntu成功安装高版本python,使用其他命令出现subprocess.CalledProcessError错误

1.ubuntu之前安装python3.5版本,更新升级为python3.7版本。

2.使用pip3 install pyinstaller,报subprocess.CalledProcessError: Command '('lsb_release', '-a')' returned non-zero exit status 1.

ubuntu成功安装高版本python,使用其他命令出现subprocess.CalledProcessError错误_第1张图片

3.执行sudo find / -name 'lsb_release.py'

4.将相关文件进行copy

sudo cp  /usr/share/pyshared/lsb_release.py /usr/local/python3/lib/python3.9/

5.执行sudo locate CommandNotFound

ubuntu成功安装高版本python,使用其他命令出现subprocess.CalledProcessError错误_第2张图片

6.将上面的35修改为37 

sudo mv /usr/lib/python3/dist-packages/CommandNotFound/__pycache__/CommandNotFound.cpython-35.pyc /usr/lib/python3/dist-packages/CommandNotFound/__pycache__/CommandNotFound.cpython-37.pyc

sudo mv /usr/lib/python3/dist-packages/CommandNotFound/__pycache__/__init__.cpython-35.pyc /usr/lib/python3/dist-packages/CommandNotFound/__pycache__/__init__.cpython-37.pyc

sudo mv /usr/lib/python3/dist-packages/CommandNotFound/__pycache__/util.cpython-35.pyc /usr/lib/python3/dist-packages/CommandNotFound/__pycache__/util.cpython-37.pyc

 7.再次执行sudo pip3 install pyinstaller 成功

 

 

 

 

你可能感兴趣的:(ubuntu,python)