Install sklearn on Raspberry Pi 4B

 This article records the steps to install the sklearn library in the Raspberry Pi 4B and the problems encountered during installation

installation steps

sudo pip3 install numpy==1.23.5

sudo apt-get install python3-numpy python3-scipy -y

sudo apt-get install python3-sklearn -y

It is worth noting that the numpy version cannot be too high . After installing the numpy1.24.2 version, I encountered the following error after running the program, and the screenshot is as follows

 

 Main error message:

AttributeError: module 'numpy' has no attribute 'float'.
`np.float` was a deprecated alias for the builtin `float`. To avoid this error in existing code, use `float` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.float64` here

Then install numpy==1.23.5 to solve the problem

sudo pip3 install numpy==1.23.5 --upgrade #Update to the specified version

Guess you like

Origin blog.csdn.net/qq_45064423/article/details/129039523