1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Raspberry Pi でOpenCVやらTensorFlowやらをやろうとしたときのエラーと対処

Last updated at Posted at 2020-08-12

ここを参考にしながらTensorFlowをインストールすると、
https://qiita.com/taisuke3/items/3f8690137672174ac8d0

動作確認プログラムでエラーが出た。

numpy/core/_multiarray_umath.cpython-35m-arm-linux-gnueabihf.so: undefined symbol: cblas_sgemm – Raspberry Pi

調べてみるとどうやらnumpy関連のようで、対処は色々あったが、どれもうまくいかず。

参考にしたページの一つ
https://jaredrhodes.com/2019/07/22/numpy-core-_multiarray_umath-cpython-35m-arm-linux-gnueabihf-so-undefined-symbol-cblas_sgemm-raspberry-pi/

numpyをuninstallしてinstallするを繰り返しているうちに、元々入れていたOpenCVからのnumpyインポートでエラーが起こるように。

ImportError: numpy.core.multiarray failed to import

そしてここを参考にしながら、
https://qiita.com/kai0706/items/8169d01a83f63fc4a0bd

これをやってみると、

$ python3
>>>import sys
>>>sys.path

このように出た。

['', '/usr/lib/python35.zip', '/usr/lib/python3.5', '/usr/lib/python3.5/plat-arm-linux-gnueabihf', '/usr/lib/python3.5/lib-dynload', '/home/pi/.local/lib/python3.5/site-packages', '/usr/local/lib/python3.5/dist-packages', '/usr/lib/python3/dist-packages']

当たり前だが、Pythonにもライブラリロード順があるということが分かったので、'/home/pi/.local/lib/python3.5/site-packages', '/usr/local/lib/python3.5/dist-packages'といったあたりが'/usr/lib/python3/dist-packages'よりも前にあることが怪しいと思い、この一文を.bashrcに追記したらOpenCVのエラーもTensorFlowの動作確認プログラムもうまくいった!

export PYTHONPATH="/usr/lib/python3/dist-packages"
1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?