将 sklearn 从 0.14.1 升级到 0.16.1 不起作用 [英] upgrading sklearn from 0.14.1 to 0.16.1 not working
问题描述
我需要将我的 sklearn 安装升级到 0.14.1,因为我当前的版本没有 凝聚聚类.
I need to upgrade my sklearn installation to 0.14.1 since my current version doesn't have agglomerative clustering.
我下载了 0.16.1 的源代码,将其解压缩,然后在文件夹中以这种方式使用 pip 运行安装:
I downloaded the source for 0.16.1, extract it and within the folder I run the installation with pip this way:
sudo pip install .
尽管在以下摘录中抱怨缺少地图集
Despite complaining about missing atlas as in the following extract
Installing collected packages: scikit-learn
Found existing installation: scikit-learn 0.14.1
Not uninstalling scikit-learn at /usr/lib/python2.7/dist-packages, owned by OS
Running setup.py install for scikit-learn
Partial import of sklearn during the build process.
blas_opt_info:
blas_mkl_info:
libraries mkl,vml,guide not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
NOT AVAILABLE
openblas_info:
libraries not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
NOT AVAILABLE
atlas_blas_threads_info:
Setting PTATLAS=ATLAS
libraries ptf77blas,ptcblas,atlas not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
NOT AVAILABLE
atlas_blas_info:
libraries f77blas,cblas,atlas not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/x86_64-linux-gnu']
NOT AVAILABLE
/usr/lib/python2.7/dist-packages/numpy/distutils/system_info.py:1521: UserWarning:
Atlas (http://math-atlas.sourceforge.net/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [atlas]) or by setting
the ATLAS environment variable.
warnings.warn(AtlasNotFoundError.__doc__)
blas_info:
FOUND:
libraries = ['blas']
library_dirs = ['/usr/lib']
language = f77
FOUND:
libraries = ['blas']
library_dirs = ['/usr/lib']
define_macros = [('NO_ATLAS_INFO', 1)]
language = f77
sklearn/setup.py:73: UserWarning:
Blas (http://www.netlib.org/blas/) libraries not found.
Directories to search for the libraries can be specified in the
numpy/distutils/site.cfg file (section [blas]) or by setting
the BLAS environment variable.
warnings.warn(BlasNotFoundError.__doc__)
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
安装显示成功信息:
Successfully installed scikit-learn
Cleaning up...
但是在安装后检查 scikit-learn 版本显示为 0.14 并且导入 AgglomerativeClustering 失败.你能帮我吗?
Yet checking the scikit-learn version after installation is showing 0.14 and importing the AgglomerativeClustering is failing. Can you help?
推荐答案
apt
和 pip
都是包管理器,可用于全局安装 python 包.经验法则:切勿将试图安装到相同目录的两个包管理器混在一起.
apt
and pip
are both package managers that can be used to install python packages globally. Rule of thumb: Never mix two package managers that try to install into the same directories.
在这种情况下,pip
足够聪明,不会破坏 apt
的安装,因此更新后旧版本仍然存在.最简单的解决方法是先执行 apt-get remove python-sklearn
.
In this case pip
was smart enough not to break the installation by apt
and therefore the old version was still present after the update. The simplest fix is to do apt-get remove python-sklearn
first.
更好的方法是在安装包时将 apt
和 pip
严格分开.我建议根本不要使用 sudo pip
.在这种情况下,只允许 apt
全局安装 python 包.在本地,您可以直接或通过 anaconda
使用 virtualenv
来创建可以安装最新软件包的隔离环境.
A better way is to strictly separate apt
and pip
when installing packages. I would recommend not to use sudo pip
at all. In this scenario only apt
is allowed to install python packages globally. Locally you can use virtualenv
either directly or through anaconda
to create isolated environments in which you can install the latest packages.
这篇关于将 sklearn 从 0.14.1 升级到 0.16.1 不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!