平台: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 ×1