ModuleNotFoundError:没有名为“numpy.testing.decorators”的模块

问题描述 投票:0回答:1

我真的需要一些帮助,因为我已经浏览了所有的帖子,但没有任何效果。我在导入 gensim 而不是 numpy 时收到此错误(numpy 是之前的并且工作正常)。我想做的就是导入 gensim 和 numpy 来运行我的分析。

这是完整的错误消息:

---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-2-3f0b98039a34> in <module>()
      1 # pip install --user numpy==1.16.4
      2 
----> 3 import gensim
      4 #import numpy
      5 

~/.local/lib64/python3.6/site-packages/gensim/__init__.py in <module>()
      9 import logging
     10 
---> 11 from gensim import parsing, corpora, matutils, interfaces, models, similarities, utils  # noqa:F401
     12 
     13 

~/.local/lib64/python3.6/site-packages/gensim/corpora/__init__.py in <module>()
      4 
      5 # bring corpus classes directly into package namespace, to save some typing
----> 6 from .indexedcorpus import IndexedCorpus  # noqa:F401 must appear before the other classes
      7 
      8 from .mmcorpus import MmCorpus  # noqa:F401

~/.local/lib64/python3.6/site-packages/gensim/corpora/indexedcorpus.py in <module>()
     12 import numpy
     13 
---> 14 from gensim import interfaces, utils
     15 
     16 logger = logging.getLogger(__name__)

~/.local/lib64/python3.6/site-packages/gensim/interfaces.py in <module>()
     17 import logging
     18 
---> 19 from gensim import utils, matutils
     20 
     21 

~/.local/lib64/python3.6/site-packages/gensim/matutils.py in <module>()
     17 import numpy as np
     18 import scipy.sparse
---> 19 from scipy.stats import entropy
     20 import scipy.linalg
     21 from scipy.linalg.lapack import get_lapack_funcs

/cluster/apps/python/3.6.4_cpu/lib64/python3.6/site-packages/scipy/stats/__init__.py in <module>()
    343 from .stats import *
    344 from .distributions import *
--> 345 from .morestats import *
    346 from ._binned_statistic import *
    347 from .kde import gaussian_kde

/cluster/apps/python/3.6.4_cpu/lib64/python3.6/site-packages/scipy/stats/morestats.py in <module>()
     10                    sqrt, ceil, floor, array, compress,
     11                    pi, exp, ravel, count_nonzero, sin, cos, arctan2, hypot)
---> 12 from numpy.testing.decorators import setastest
     13 
     14 from scipy._lib.six import string_types

ModuleNotFoundError: No module named 'numpy.testing.decorators'

我尝试过的: 我尝试使用最新版本的 numpy,并强制其使用版本 1.16.4“pip install --user numpy==1.16.4”。我还尝试卸载并重新安装 gensim 和 numpy,但它不起作用。我正在集群上使用 Python 3.6。我不太明白为什么numpy导入没有问题,但这是gensim的问题。

有人可以帮我解决这个问题吗?

非常感谢!

最好的, 桑德拉

python numpy installation python-3.6 gensim
1个回答
0
投票

安装 NumPy

  1. 检查Python版本: 最喜欢这个命令:python -V 或 python3 -V。
  2. 安装点: 命令:sudo apt install python-pip 或 sudo apt install python3-pip。
  3. 安装Numpy: 命令:pip install Numpy 或 pip3 install Numpy。
  4. 验证 Numpy: 命令:pip show numpy 或 pip3 show numpy
© www.soinside.com 2019 - 2024. All rights reserved.