引用numpy出错详解及解决方法

时间:2021-05-19

numpy出错 解决方案

Problem: how to import numpy in subdirectory? Import error of numpy within subfolder.

错误信息:

>>> import numpy Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/local/lib/python2.7/dist-packages/numpy/__init__.py", line 153, in <module> from . import add_newdocs File "/usr/local/lib/python2.7/dist-packages/numpy/add_newdocs.py", line 13, in <module> from numpy.lib import add_newdoc File "/usr/local/lib/python2.7/dist-packages/numpy/lib/__init__.py", line 18, in <module> from .polynomial import * File "/usr/local/lib/python2.7/dist-packages/numpy/lib/polynomial.py", line 19, in <module> from numpy.linalg import eigvals, lstsq, inv File "/usr/local/lib/python2.7/dist-packages/numpy/linalg/__init__.py", line 50, in <module> from .linalg import * File "/usr/local/lib/python2.7/dist-packages/numpy/linalg/linalg.py", line 29, in <module> from numpy.linalg import lapack_lite, _umath_linalg ImportError: libatlas.so.3gf: cannot open shared object file: No such file or directory

可能原因:

1. 子文件夹下有自己建的numpy.py文件

2. 看最后一行的错误,找不到libatlas.so.3gf. 将其所在文件夹引入/etc/ld.so.conf,缺啥补啥

$ sudo gedit /etc/ld.so.conf

写入/usr/lib/atlas-base

$ sudo ldconfig

感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!

声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。

相关文章