我已经安装了 numpy 使用
sudo pip install -I --prefix=/soft/bin/system/python/3.7.4 numpy
我现在可以导入 numpy 但 numpy 无法访问它的任何属性。
我不知道在 path/config 中设置什么以使其正常工作。
我在加载模块 python3.7.4 时尝试了设置
prepend-path PATH /soft/bin/system/python/3.7.4/bin
prepend-path LD_LIBRARY_PATH /soft/bin/system/python/3.7.4/lib/:/soft/bin/system/python/3.7.4/lib/:/soft/bin/system/python/3.7.4/lib/python3.7/site-packages/
setenv PYTHONPATH /soft/bin/system/python/3.7.4/lib/python3.7/site-packages
但没有任何效果,现在已经 2 天了。
我有这种错误
bioinfo@frontal:~$ python -c 'import numpy; numpy.test("full");'
Traceback (most recent call last):
File "<string>", line 1, in <module>
AttributeError: module 'numpy' has no attribute 'test'
bioinfo@frontal:~$ which python
/soft/bin/system/python/3.7.4/bin/python
编辑:pythonpath 变量是错误的,现在,错误更新了
bioinfo@tao:~$ python -c 'import numpy; numpy.sin;'
Traceback (most recent call last):
File "/soft/bin/system/python/3.7.4/lib/python3.8/site-packages/numpy/core/__init__.py", line 22, in <module>
from . import multiarray
File "/soft/bin/system/python/3.7.4/lib/python3.8/site-packages/numpy/core/multiarray.py", line 12, in <module>
from . import overrides
File "/soft/bin/system/python/3.7.4/lib/python3.8/site-packages/numpy/core/overrides.py", line 7, in <module>
from numpy.core._multiarray_umath import (
ModuleNotFoundError: No module named 'numpy.core._multiarray_umath'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/soft/bin/system/python/3.7.4/lib/python3.8/site-packages/numpy/__init__.py", line 145, in <module>
from . import core
File "/soft/bin/system/python/3.7.4/lib/python3.8/site-packages/numpy/core/__init__.py", line 48, 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.9 from "/soft/bin/system/python/3.9/bin/python"
* The NumPy version is: "1.20.3"
and make sure that they are the versions you expect.
Please carefully study the documentation linked above for further help.
Original error was: No module named 'numpy.core._multiarray_umath'
文件夹中的进一步调查
/soft/bin/system/python/3.7.4/lib/python3.8/site-packages/numpy/core
有一个文件叫
_multiarray_umath.cpython-38-x86_64-linux-gnu.so
为什么找不到,名称是否正确或者是使用 pip 安装的错误?