我正在使用 Ubuntu 16.04,由于依赖关系,我不能只卸载 Python 3.5。所以为了运行我的脚本,我使用 python3.8 app.py 。到目前为止没问题。但是当我想通过 pip 安装新包时: python3.8 -m pip install pylint 它抛出一个错误: AttributeError: module 'platform' has no attribute 'linux_distribution' 到目前为止...
linux_distribution方法最初存在于platform模块中,其旨在返回当前Linux发行版的名称、版本和代号。然而,在Python 3.5版本中,该方法就已经标记为弃用,并在后续版本中完全移除。这主要是因为该方法的实现依赖于系统工具的执行结果,这些信息可能因各个Linux发行版之间的差异而有所不同。 2. 新的替代方案 从Python 3.8版本...
下面是完整的代码示例: importplatformimportsys# 获取Linux发行版信息dist_name,version,_=platform.linux_distribution()# 打印Linux发行版信息print("Linux发行版: ",dist_name)print("版本号: ",version)# 获取Python3.8版本信息python_version=sys.version_info# 打印Python3.8版本信息print("Python版本号: ",pyt...
platform模块还有一些上面属性的直接接口,像这样: >>> platform.system() 'Linux' >>> platform.release() '3.7.4-204.fc18.x86_64' linux_distribution()函数返回的有关你所在的linux发布版本的详细信息。例如,在Fedora 18系统上,这个命令会返回如下信息: >>> platform.linux_distribution() ('Fedora', '18...
问platform.dist和platform.linux_distribution在python3中的替代品是什么?ENRedo日志是Oracle为确保已经...
>>>platform.linux_distribution() ('','','') 解决方案 这对我在Ubuntu上有用: ('Ubuntu','10.04','lucid') 然后我常常strace找出平台模块正在做什么来查找分布,这是这部分: open("/etc/lsb-release", O_RDONLY|O_LARGEFILE) =3fstat64(3, {st_mode=S_IFREG|0644, st_size=102, ...}) =0fst...
distroprovides information about the OS distribution it runs on, such as a reliable machine-readable ID, or version information. It is the recommended replacement for Python's originalplatform.linux_distributionfunction (removed in Python 3.8). It also provides much more functionality which isn't ne...
return platform.linux_distribution() def get_architecture(): '''获取操作系统位数''' return platform.architecture() def get_node(): '''获取主机名''' return platform.node() def get_processor(): '''获取物理CPU个数''' return psutil.cpu_count(logical=False) ...
distribution release than is supported by the repository (and the packages for the previous distribution release still work). 一般是不能连接外网,每个情况不一样,我的解决方案,执行如下命令 vi /etc/sysconfig/network-scripts/ifcfg-ens33 每个人的Linux中ifcfg-ens33名称不一定完全一样。我的配置如下: ...
cmd.py", line 107, in ensure_finalized self.finalize_options() File "/builddir/build/BUILD/meld-3.20.1/meld/build_helpers.py", line 382, in finalize_options platform.linux_distribution()[0].lower() in special_cases): AttributeError: module 'platform' has no attribute 'linux_distribution'...