Anaconda“环境不一致”并且Spyder无法识别导入的模块

时间:2019-09-08 08:15:52

标签: python anaconda conda

自从我尝试安装新软件包(scikit-image)以来,我的Spyder发行版一直存在问题:尝试安装后,即使程序本身似乎响应,最初我的Spyder IDE编辑器也不会启动IDE;遵循一些互联网建议,我运行了各种命令,包括“ conda update -all”和“ conda --reset”,最终我再次打开了它。

但是,现在看来我的安装有点中断:Spyder IDE无法识别任何已安装的模块,并且每当我尝试导入用于测试的软件包时,它都会响应“ AttributeError:module'numpy'没有属性' 版本””(即通过导入熊猫或matplotlib)或只是“未找到模块”(即,导入sklearn)。

到目前为止,我尝试过的每个解决方案,例如“ conda update conda”,“ conda install conda / anaconda”,都遇到“ Inconsistent Environment”错误,到目前为止没有任何帮助:

(base) C:\Users\black>conda update conda
Collecting package metadata (repodata.json): done
Solving environment: |
The environment is inconsistent, please check the package plan carefully
The following packages are causing the inconsistency:

  - defaults/win-64::anaconda==custom=py35h64770cb_0
  - bashtage/win-64::arch==4.4.1=np115py35_0
  - https://repo.continuum.io/pkgs/free/win-64::blaze==0.10.1=py35_0
  - defaults/win-64::bokeh==0.13.0=py35_0
  - defaults/win-64::bottleneck==1.2.1=py35h452e1ab_1
  - https://repo.continuum.io/pkgs/free/win-64::conda-build==1.21.3=py35_0
  - defaults/win-64::datashape==0.5.4=py35_1
  - conda-forge/win-64::deap==1.2.2=py35h830ac7b_0
  - https://repo.continuum.io/pkgs/free/win-64::dynd-python==0.7.2=py35_0
  - defaults/win-64::h5py==2.8.0=py35h3bdd7fb_2
  - conda-forge/noarch::hyperopt==0.1.2=py_0
  - defaults/win-64::imageio==2.4.1=py35_0
  - defaults/win-64::keras==2.2.2=0
  - defaults/win-64::keras-applications==1.0.4=py35_1
  - defaults/win-64::keras-base==2.2.2=py35_0
  - defaults/win-64::keras-preprocessing==1.0.2=py35_1
  - defaults/win-64::matplotlib==3.0.0=py35hd159220_0
  - defaults/win-64::mkl_fft==1.0.6=py35hdbbee80_0
  - defaults/win-64::mkl_random==1.0.1=py35h77b88f5_1
  - conda-forge/noarch::mlxtend==0.13.0=py_1
  - https://repo.continuum.io/pkgs/free/win-64::nbpresent==3.0.2=py35_0
  - https://repo.anaconda.com/pkgs/free/win-64::nb_anacondacloud==1.4.0=py35_0
  - defaults/win-64::pandas==0.23.4=py35h830ac7b_0
  - ankurankan/win-64::pgmpy==0.1.6=py35h8fcecb5_0
  - defaults/win-64::pygpu==0.7.6=py35h452e1ab_0
  - https://repo.anaconda.com/pkgs/free/win-64::pytables==3.2.2=np113py35_4
  - pytorch/win-64::pytorch-cpu==0.4.1=py35_cpuhe774522_1
  - defaults/win-64::quandl==3.4.2=py35_0
  - defaults/win-64::scipy==1.1.0=py35hc28095f_0
  - quantopian/win-64::ta-lib==0.4.9=np114py35_0
  - defaults/win-64::tensorboard==1.10.0=py35he025d50_0
  - conda-forge/win-64::tpot==0.9.5=py35_1
  - conda-forge/win-64::uncertainties==3.0.2=py35_1
failed
Solving environment: \
Found conflicts! Looking for incompatible packages.
This can take several minutes.  Press CTRL-C to abort.
Examining numpy-base:   3%|█▉                                                       | 13/378 [00:00<00:00, 3681.70it/s]
Comparing specs that have this dependency:   0%|                                                | 0/30 [00:00<?, ?it/s]
| mparing specs that have this dependency:   3%|█▎        

然后继续进行下去,我取消了它,因为它要永远运行,而且我不知道它的作用。我该怎么办?我应该删除并重新安装Anaconda吗?那是否意味着我还将删除任何自定义软件包(有很多)?

我必须指出,我仍然对整个Anaconda软件包管理,虚拟环境和路径如何工作还一无所知,因此,如果有人也很友善​​地链接任何好的资源,解释这些事情将特别有帮助。

非常感谢您的帮助!

1 个答案:

答案 0 :(得分:1)

conda documentation应该告诉您开始需要什么。

发生问题的原因是,如果您尝试在base环境中安装或升级软件包,conda必须尝试在Anaconda发行版中找到每个软件包的相互兼容版本,这可能是不可能的或涉及许多软件包降级。

简单的答案始终是,如果要新的或升级的软件包,则可以通过Navigator或使用conda create创建一个新环境。通过仅指定需要一起使用的软件包,conda会更容易找到合适的组合。

如果要在新环境中使用Spyder,请包括spyder软件包-或仅使用命令行spyder-kernels来减少所需的磁盘空间。