Solução:
sudo ln -s /usr/share/pyshared/lsb_release.py /usr/local/lib/python3.6/site-packages/lsb_release.py
Explique:
Podemos ver em /usr/bin/lsb_release
#!/usr/bin/python3 -Es
# lsb_release command for Debian
# (C) 2005-10 Chris Lawrence <[email protected]>
# This package is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 dated June, 1991.
# This package is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this package; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
# 02110-1301 USA
from optparse import OptionParser
import sys
import os
import re
import lsb_release
O passo chave é import lsb_release
, mas o problema é que Python 3.6
não tem este módulo.
Portanto, você deve ter substituído o python3
de python3.5
para python3.6
. É por isso que seu lsb_release
está quebrado.
Para verificar isso, podemos ver em python3.6
:
➜ ~ python3.6
Python 3.6.4 (default, Feb 6 2018, 16:57:12)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import lsb_release
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'lsb_release'
e, em seguida, em python3.5
:
➜ ~ python3.5
Python 3.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import lsb_release
>>> lsb_release.__file__
'/usr/lib/python3/dist-packages/lsb_release.py'
onde está este arquivo:
➜ ~ ll /usr/lib/python3/dist-packages/lsb_release.py
lrwxrwxrwx 1 root root 38 Jul 7 2016 /usr/lib/python3/dist-packages/lsb_release.py -> ../../../share/pyshared/lsb_release.py
Portanto, este módulo lsb_release
existe em python3.5
, mas não existe em python3.6
. E nós encontramos eventualmente!
Agora vamos corrigir isso adicionando um link para o arquivo lsb_release.py
original!
Funciona para mim!