python-2.7 – conda update scikit-learn(也是scipy和numpy)

python-2.7 – conda update scikit-learn(也是scipy和numpy),第1张

概述当我应该使用conda时,我想我使用pip install弄得一团糟.因此,我无法将scikit-learn软件包更新到最新版本.我用conda和pip卸载scikit-learn,然后使用conda再次安装但是现在我有问题导入sklearn: Python 2.7.11 |Anaconda custom (x86_64)| (default, Dec 6 2015, 18:57:58) [G 当我应该使用conda时,我想我使用pip install弄得一团糟.因此,我无法将scikit-learn软件包更新到最新版本.我用conda和pip卸载scikit-learn,然后使用conda再次安装但是现在我有问题导入sklearn:

Python 2.7.11 |Anaconda custom (x86_64)| (default,Dec  6 2015,18:57:58) [GCC 4.2.1 (Apple Inc. build 5577)] on darwinType "help","copyright","credits" or "license" for more information.Anaconda is brought to you by Continuum Analytics.Please check out: http://continuum.io/thanks and https://anaconda.orgfrom sklearn import metricsTraceback (most recent call last):  file "<stdin>",line 1,in <module>  file "/Users/bowang/anaconda/lib/python2.7/site-packages/sklearn/metrics/__init__.py",line 7,in <module>    from .ranking import aucimportError: No module named ranking

此外,它实际上使用的sklearn / numpy / scipy版本似乎存在混淆:

$conda update scikit-learnUsing Anaconda Cloud API site https://API.anaconda.orgFetching package Metadata: ......Solving package specifications: .........# All requested packages already installed.# packages in environment at /Users/bowang/anaconda:#scikit-learn              0.15.2               np18py27_0    http://repo.continuum.io/pkgs/free/osx-64/scikit-learn-0.15.2-np18py27_0.tar.bz2$conda update scipyUsing Anaconda Cloud API site https://API.anaconda.orgFetching package Metadata: ......Solving package specifications: .........# All requested packages already installed.# packages in environment at /Users/bowang/anaconda:#scipy                     0.14.0               np18py27_0    http://repo.continuum.io/pkgs/free/osx-64/scipy-0.14.0-np18py27_0.tar.bz2

以上显示我仍然无法更新到最新版本但是:

$pythonPython 2.7.11 |Anaconda custom (x86_64)| (default,"credits" or "license" for more information.Anaconda is brought to you by Continuum Analytics.Please check out: http://continuum.io/thanks and https://anaconda.org>>> import scipy>>> scipy.__version__'0.17.0'>>> import numpy>>> numpy.__version__'1.11.0'>>> import sklearn>>> sklearn.__version__'0.17.1'

有没有办法清理和解决这里的所有混淆,并允许我更新,从而使用最新版本的sklearn / numpy / scipy?谢谢!

解决方法 看起来conda报告的版本与运行Python时导入的版本不匹配.这让我觉得你已经在多个地方安装了这些软件包,并设置了你的$PYTHONPATH变量,以便Python找到不同的安装(有时安装一些工具包会在你的bash / sh启动脚本中添加它)尝试运行

$echo $PYTHONPATH

如果此处显示任何内容,请找到您的启动脚本并对其进行评论.
确保$PYTHONPATH为空后,请尝试以下 *** 作:

$conda update conda  # make sure package Listing is up-to-date$conda remove numpy scipy scikit-learn$conda install scikit-learn

这在过去对我来说一般都有用.

总结

以上是内存溢出为你收集整理的python-2.7 – conda update scikit-learn(也是scipy和numpy)全部内容,希望文章能够帮你解决python-2.7 – conda update scikit-learn(也是scipy和numpy)所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/1193629.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-06-03
下一篇 2022-06-03

发表评论

登录后才能评论

评论列表(0条)

保存