ラズパイでNumpyをpipでインストールしたのですが、それだと以下のエラーが出てしまいました。
エラー内に記述されているトラブルシューティングのURLを確認します。
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Traceback (most recent call last):
File "/home/pi/.local/lib/python3.5/site-packages/numpy/core/__init__.py", line 24, in <module>
from . import multiarray
File "/home/pi/.local/lib/python3.5/site-packages/numpy/core/multiarray.py", line 14, in <module>
from . import overrides
File "/home/pi/.local/lib/python3.5/site-packages/numpy/core/overrides.py", line 7, in <module>
from numpy.core._multiarray_umath import (
ImportError: libf77blas.so.3: cannot open shared object file: No such file or directory
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "test.py", line 1, in <module>
import numpy as np
File "/home/pi/.local/lib/python3.5/site-packages/numpy/__init__.py", line 142, in <module>
from . import core
File "/home/pi/.local/lib/python3.5/site-packages/numpy/core/__init__.py", line 50, in <module>
raise ImportError(msg)
ImportError:
IMPORTANT: PLEASE READ THIS FOR ADVICE ON HOW TO SOLVE THIS ISSUE!
Importing the numpy C-extensions failed. This error can happen for
many reasons, often due to issues with your setup or how NumPy was
installed.
We have compiled some common reasons and troubleshooting tips at:
https://numpy.org/devdocs/user/troubleshooting-importerror.html
Please note and check the following:
* The Python version is: Python3.5 from "/usr/bin/python3"
* The NumPy version is: "1.18.5"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: libf77blas.so.3: cannot open shared object file: No such file or directory
ラズパイへNumPyのインストール方法は別に存在した
トラブルシューティングを確認するとpipでインストールすると駄目っぽい事が書かれています。
There are sometimes issues reported on Raspberry Pi setups when installing using pip3 install (or pip install). These will typically mention:
指示に従い、以下のコマンドを実行します
$ sudo apt-get install libatlas-base-dev
$ pip3 uninstall numpy # remove previously installed version
$ apt install python3-numpy
この手順を踏むとNumPyがラズパイで使用できるようになりました。
環境
- RasberryPi 3B
- Raspbian GNU/Linux 9.8 (stretch)
- python3-numpy1.12.1