【发布时间】:2020-07-08 15:30:47
【问题描述】:
当我在 WSL2(ubuntu 20.04) 中用 python 编写代码时:
>>import os
>>os.uname()
输出是:
posix.uname_result(sysname='Linux', nodename='Saqib-PC', release='4.19.104-microsoft-standard', version='#1 SMP Wed Feb 19 06:37:35 UTC 2020', machine='x86_64')
但是当我在 Windows 终端上运行相同的代码时,它给了我一个 AttributeError:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'os' has no attribute 'uname'
这里给出了 Windows 终端和 WSL2 中的截图:
在 Windows 终端中: see image here
在 WSL2(Ubuntu 20.04)中: see image here
顺便说一句:其他操作系统模块的工作文件在两者中
谁能告诉我为什么会这样?
【问题讨论】:
标签: python windows-terminal wsl-2