Search code examples
pythonapple-m1psutil

ModuleNotFoundError: No module named '_psutil_osx'


When I wanted to import '_psutil_osx' ,Error happend.

This is the clause

import _psutil_osx

and the error

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named '_psutil_osx'

And I confirmed that I have installed psutil, that's the result of pip list

Package    Version
---------- -------
pip        23.1.2
psutil     5.9.5
PyGreSQL   5.2.4
PyYAML     6.0
setuptools 67.6.1
six        1.16.0
wheel      0.40.0`

ps: I runned this on Apple Silicon (M1)

I want to import _psutil_osx success


Solution

  • _psutil_osx is a submodule of psutil so try

    import psutil._psutil_osx
    

    or

    from psutil import _psutil_osx