树莓派4B 安装 sklearn

 本文记录在树莓派4B中安装sklearn库的步骤以及安装时遇到的问题

安装步骤

sudo pip3 install numpy==1.23.5

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

sudo apt-get install python3-sklearn -y

值得注意的是,numpy版本不能过高。在安装了numpy1.24.2版本后,运行程序后遇到如下错误,截图如下

 

 主要错误提示:

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

之后安装numpy==1.23.5就解决了该问题

sudo pip3 install numpy==1.23.5 --upgrade #更新到指定版本

猜你喜欢

转载自blog.csdn.net/qq_45064423/article/details/129039523