我需要将我的sklearn安装升级到0.14.1,因为我当前的版本没有聚合集群。
我下载了0.16.1的源代码,提取它,并在我使用pip运行安装的文件夹中:
sudo pip install .
尽管抱怨缺少地图集,如以下摘录
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,并且导入agglomerativecluster失败。你能帮忙吗?
apt
和pip
都是包管理器,可用于全局安装python包。经验法则:永远不要把两个试图安装到相同目录的包管理器混在一起。
在这种情况下,pip
足够聪明,不会破坏apt
的安装,因此更新后旧版本仍然存在。最简单的修复方法是先执行apt-get remove python-sklearn
。
更好的方法是在安装包时严格分离apt
和pip
。我建议不要使用sudo pip
。在这种情况下,只允许apt
全局安装python包。在本地,您可以直接使用virtualenv
或通过anaconda
创建可以安装最新软件包的隔离环境。