'AttributeError: module 'os' has no attribute 'uname'. Did you mean: 'name'?

when i am doing this, i get this error:

import numpy as np
import matplotlib.pyplot as plt

y = np.array([1,2,3,4,3,2,1,4,5,2,4])

print(y)
plt.hist(y)

i get error:

Traceback (most recent call last):
  File "C:\Python\lib\platform.py", line 831, in uname
    system, node, release, version, machine = infos = os.uname()
AttributeError: module 'os' has no attribute 'uname'. Did you mean: 'name'? 

How can I fix this is my python broken or something else because it works in jupyter notebook bur doesn't work in vs code. Thanking you in advance.



Solution 1:[1]

uname is originally a unix command and so is only available to unix like platform you can use platform instead

import platform
platform.platform()
#u can also use platform.platform()

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 geek