Search code examples
pythonlinuxraspberry-piraspberry-pi3raspbian

Issue using psutil (Python Module) on RasPi


i would like to install the psutil module to read the CPU data. Unfortunately after the installation the following is still displayed when the code is executed.

import psutil ImportError: No module named 'psutil'

As I have seen, the installation was done in the Python 2.7 folder. However, I use python 3.5 in the shell as well as in Thonny. This question has already been answered on stackoverflow, but I could not solve it with the given information.

How do I install psutil for Python 3.5?

I already installed it with...

sudo apt-get install python3-psutil

so also ...

apt-get install python3-psutil

tried it out. The second option indicated that the root directory could not be locked.

What is the correct way to use the Psutil module?

BG and Thank you!


Solution

  • I've already solved it.

    The command to enter is:

    sudo pip3 install psutil

    now the module runs with Python 3