Home > Enterprise >  AttributeError: module 'os' has no attribute 'uname'. Did you mean: 'name&#
AttributeError: module 'os' has no attribute 'uname'. Did you mean: 'name&#

Time:05-21

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.

CodePudding user response:

Could you elaborate on the versions of python, numpy and matplotlib you are using?

os.uname is available only on unix machines so I guess you are running on your windows machine now. Where is your jupyter notebook located? Was it running on your windows machine as well?

CodePudding user response:

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()
  • Related