Numpy报错解决办法

bug描述:

经常出现加载numpy会报错或者在安装tensoflow、pytorch时,出现如下错误:

问题一:

RuntimeError: module compiled against API version 0xc but this version of numpy is 0xb
Traceback (most recent call last):
  File "/home/hcguo/miniconda3/envs/wes/bin/bamCoverage", line 5, in 
    from deeptools.bamCoverage import main
  File "/home/hcguo/miniconda3/envs/wes/lib/python2.7/site-packages/deeptools/bamCoverage.py", line 8, in 
    from deeptools import writeBedGraph  # This should be made directly into a bigWig
  File "/home/hcguo/miniconda3/envs/wes/lib/python2.7/site-packages/deeptools/writeBedGraph.py", line 5, in 
    import pyBigWig
ImportError: numpy.core.multiarray failed to import

问题二:

 FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated;in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'._np_qint8 = np.dtype([("qint8", np.int8, 1)]) 

 解决办法:

一般这种问题都是版本问题,需要将版本降低。一般来说,numpy1.17版本都比较高,可能支持不太好,博主试了好几个都是因为1.17版本报错的原因,解决办法是:

pip3 install numpy==1.16

将版本降低,如果还是不行,则试试15,14.....

如果不想这样一个一个试就我就用下面命令查了一下我的numpy文件的版本

pip show numpy

我们回到之前的出现问题中, RuntimeError: module compiled against API version 0xc but this version of numpy is 0xb

说明你需要的是0xc版本的numpy,然后去查一下这个对应的numpy版本,下载就好;

你可能感兴趣的:(Bug解决方案,加载numpy报错,failed,t)