小编Ric*_* Xu的帖子

从源代码安装 Python 3.6.3 后没有名为“lsb_release”的模块

平台:ubuntu 17.04 服务器

ubuntu 17.04 服务器安装包括 python 2.7 和 python 3.5。我从源代码手动安装了 Python 3.6.3。然而,lsb_release -a失败了:

# lsb_release -a
Traceback (most recent call last):
  File "/usr/bin/lsb_release", line 25, in <module>
    import lsb_release
ModuleNotFoundError: No module named 'lsb_release'
Run Code Online (Sandbox Code Playgroud)

但是,如果我修改该文件的第一行lsb_release

#!/usr/bin/python3 -Es
Run Code Online (Sandbox Code Playgroud)

#!/usr/bin/python3.5 -Es
Run Code Online (Sandbox Code Playgroud)

它再次起作用。

# lsb_release -a
LSB Version:    core-9.20160110ubuntu5-amd64:core-9.20160110ubuntu5-noarch:security-9.20160110ubuntu5-amd64:security-9.20160110ubuntu5-noarch
Distributor ID: Ubuntu
Description:    Ubuntu 17.04
Release:    17.04
Codename:   zesty
Run Code Online (Sandbox Code Playgroud)

以下是模块搜索路径:

# python3.5
Python 3.5.3 (default, Sep 14 2017, 22:58:41) 
[GCC 6.3.0 20170406] on linux
Type "help", "copyright", …
Run Code Online (Sandbox Code Playgroud)

python3

16
推荐指数
1
解决办法
2万
查看次数

标签 统计

python3 ×1