Ubuntu18.04 在有python3.6的情况下,安装python3.7,引发的问题

1. ModuleNotFoundError: No module named 'apt_pkg'

系统本身的python 是python3.6 ,让系统默认使用3.7

sudo apt-get remove --purge python-apt
sudo apt-get install python-apt -f 
cd /usr/lib/python3/dist-packages/ 
sudo cp apt_pkg.cpython-3?m-x86_64-linux-gnu.so apt_pkg.cpython-37m-x86_64-linux-gnu.so 

 2. ImportError: cannot import name '_gi'

ls /usr/lib/python3/dist-packages/gi/
cd /usr/lib/python3/dist-packages/gi/

$ sudo cp _gi.cpython-3?m-x86_64-linux-gnu.so _gi.cpython-37m-x86_64-linux-gnu.so
$ sudo cp _gi_cairo.cpython-3?m-x86_64-linux-gnu.so _gi_cairo.cpython-37m-x86_64-linux-gnu.so

 

你可能感兴趣的:(Ubuntu系统学习)