gpt4 book ai didi

python - 在 python 中导入 numpy 时出现 "ImportError: cannot import name SkipTest"

转载 作者:太空宇宙 更新时间:2023-11-04 03:10:53 25 4
gpt4 key购买 nike

我在导入 numpy 时遇到问题。

请查看以下版本信息:

# cat /etc/redhat-release
CentOS release 6.5 (Final)

# python -V
Python 2.6.6

我已经使用 pip 安装了 numpy(重新安装了几次)。

# pip install numpy

但是,当我尝试导入 numpy 时,它显示如下错误:

# python
Python 2.6.6 (r266:84292, Jul 23 2015, 15:22:56)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> import numpy
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib64/python2.6/site-packages/numpy/__init__.py", line 180, in <module>
from . import add_newdocs
File "/usr/lib64/python2.6/site-packages/numpy/add_newdocs.py", line 13, in <module>
from numpy.lib import add_newdoc
File "/usr/lib64/python2.6/site-packages/numpy/lib/__init__.py", line 8, in <module>
from .type_check import *
File "/usr/lib64/python2.6/site-packages/numpy/lib/type_check.py", line 11, in <module>
import numpy.core.numeric as _nx
File "/usr/lib64/python2.6/site-packages/numpy/core/__init__.py", line 58, in <module>
from numpy.testing.nosetester import _numpy_tester
File "/usr/lib64/python2.6/site-packages/numpy/testing/__init__.py", line 12, in <module>
from . import decorators as dec
File "/usr/lib64/python2.6/site-packages/numpy/testing/decorators.py", line 21, in <module>
from .utils import SkipTest
ImportError: cannot import name SkipTest
>>>

我什至尝试过“yum reinstall python”。在所有情况下(numpy 和 python 本身)安装都成功完成。但仍然有与上面相同的错误“ImportError:无法导入名称 SkipTest”。

我们将不胜感激任何解决方法。

谢谢,奥拜德

最佳答案

确实,较新的 numpies 不再支持 python 2.6

关于python - 在 python 中导入 numpy 时出现 "ImportError: cannot import name SkipTest",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38069417/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com