gpt4 book ai didi

python - 在 Ubuntu 中安装 scikit-learn 时遇到一些麻烦

转载 作者:行者123 更新时间:2023-12-04 18:54:46 24 4
gpt4 key购买 nike

关闭。这个问题不符合Stack Overflow guidelines .它目前不接受答案。












我们不允许在 Stack Overflow 上提出有关通用计算硬件和软件的问题。您可以编辑问题,使其成为 on-topic对于堆栈溢出。


8年前关闭。







Improve this question




我只是从 https://pypi.python.org/pypi/scikit-learn/ 下载了 scikit-learn 安装包.

在安装包之前,我使用 apt-get 安装了几个依赖包:

sudo apt-get install build-essential python-dev python-numpy python-setuptools python-scipy libatlas-dev

进入安装目录后,运行命令 python setup.py install .
但是收到回复 error: could not create '/usr/local/lib/python2.7/dist-packages/sklearn': Permission denied
我发现问题出在 ATLAS 和 BLAS 上,但我对它们并不熟悉。所以我需要一些帮助来解决它。我将详细信息粘贴到终端中:
Appending sklearn.__check_build configuration to sklearn
Ignoring attempt to set 'name' (from 'sklearn' to 'sklearn.__check_build')
Warning: Assuming default configuration (svm/tests/{setup_tests,setup}.py was not found)Appending sklearn.svm.tests configuration to sklearn.svm
Ignoring attempt to set 'name' (from 'sklearn.svm' to 'sklearn.svm.tests')
/usr/lib/python2.7/dist-packages/numpy/distutils/system_info.py:1423: 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__)
Appending sklearn.svm configuration to sklearn
Ignoring attempt to set 'name' (from 'sklearn' to 'sklearn.svm')
Appending sklearn.datasets configuration to sklearn
Ignoring attempt to set 'name' (from 'sklearn' to 'sklearn.datasets')
Warning: Assuming default configuration (./datasets/tests/setup_datasets/{setup_datasets/tests,setup}.py was not found)Appending sklearn.datasets/tests configuration to sklearn
Ignoring attempt to set 'name' (from 'sklearn' to 'sklearn.datasets/tests')
Appending sklearn.feature_extraction configuration to sklearn
Ignoring attempt to set 'name' (from 'sklearn' to 'sklearn.feature_extraction')
Warning: Assuming default configuration (./feature_extraction/tests/setup_feature_extraction/{setup_feature_extraction/tests,setup}.py was not found)Appending sklearn.feature_extraction/tests configuration to sklearn
Ignoring attempt to set 'name' (from 'sklearn' to 'sklearn.feature_extraction/tests')
Traceback (most recent call last):
File "setup.py", line 91, in <module>
setup(**configuration(top_path='').todict())
File "setup.py", line 23, in configuration
config.add_subpackage('cluster')
File "/usr/lib/python2.7/dist-packages/numpy/distutils/misc_util.py", line 1002, in add_subpackage
caller_level = 2)
File "/usr/lib/python2.7/dist-packages/numpy/distutils/misc_util.py", line 971, in get_subpackage
caller_level = caller_level + 1)
File "/usr/lib/python2.7/dist-packages/numpy/distutils/misc_util.py", line 883, in _get_configuration_from_setup_py
('.py', 'U', 1))
File "./cluster/setup.py", line 8, in <module>
from sklearn._build_utils import get_blas_info
ImportError: No module named sklearn._build_utils
hujun@hujun-OptiPlex-790:~/下载/scikit-learn-0.14.1/sklearn$ cd ..
hujun@hujun-OptiPlex-790:~/下载/scikit-learn-0.14.1$ python setup.py install
Partial import of sklearn during the build process.
blas_opt_info:
blas_mkl_info:
libraries mkl,vml,guide not found in /usr/local/lib
libraries mkl,vml,guide not found in /usr/lib
libraries mkl,vml,guide not found in /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
libraries ptf77blas,ptcblas,atlas not found in /usr/lib
libraries ptf77blas,ptcblas,atlas not found in /usr/lib/x86_64-linux-gnu
NOT AVAILABLE

atlas_blas_info:
libraries f77blas,cblas,atlas not found in /usr/local/lib
libraries f77blas,cblas,atlas not found in /usr/lib
libraries f77blas,cblas,atlas not found in /usr/lib/x86_64-linux-gnu
NOT AVAILABLE

/usr/lib/python2.7/dist-packages/numpy/distutils/system_info.py:1423: 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:
libraries blas not found in /usr/local/lib
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:77: 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__)
running install
running build
running config_cc
unifing config_cc, config, build_clib, build_ext, build commands --compiler options
running config_fc
unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
running build_src
build_src
building library "libsvm-skl" sources
building library "cblas" sources
building extension "sklearn.__check_build._check_build" sources
building extension "sklearn.svm.libsvm" sources
building extension "sklearn.svm.liblinear" sources
building extension "sklearn.svm.libsvm_sparse" sources
building extension "sklearn.datasets._svmlight_format" sources
building extension "sklearn.feature_extraction._hashing" sources
building extension "sklearn.cluster._hierarchical" sources
building extension "sklearn.cluster._k_means" sources
building extension "sklearn.ensemble._gradient_boosting" sources
building extension "sklearn.utils.sparsetools._min_spanning_tree" sources
building extension "sklearn.utils.sparsetools._traversal" sources
building extension "sklearn.utils.sparsetools._graph_tools" sources
building extension "sklearn.utils.arraybuilder" sources
building extension "sklearn.utils.sparsefuncs" sources
building extension "sklearn.utils.arrayfuncs" sources
building extension "sklearn.utils.murmurhash" sources
building extension "sklearn.utils.lgamma" sources
building extension "sklearn.utils.graph_shortest_path" sources
building extension "sklearn.utils.seq_dataset" sources
building extension "sklearn.utils.weight_vector" sources
building extension "sklearn.utils.random" sources
building extension "sklearn.utils._logistic_sigmoid" sources
building extension "sklearn.neighbors.ball_tree" sources
building extension "sklearn.neighbors.kd_tree" sources
building extension "sklearn.neighbors.dist_metrics" sources
building extension "sklearn.neighbors.typedefs" sources
building extension "sklearn.metrics.pairwise_fast" sources
building extension "sklearn.tree._tree" sources
building extension "sklearn.metrics/cluster.expected_mutual_info_fast" sources
building extension "sklearn._hmmc" sources
building extension "sklearn._isotonic" sources
building extension "sklearn.linear_model.cd_fast" sources
building extension "sklearn.linear_model.sgd_fast" sources
building extension "sklearn.utils.sparsetools._min_spanning_tree" sources
building extension "sklearn.utils.sparsetools._traversal" sources
building extension "sklearn.utils.sparsetools._graph_tools" sources
building extension "sklearn.utils.arraybuilder" sources
building extension "sklearn.utils.sparsefuncs" sources
building extension "sklearn.utils.arrayfuncs" sources
building extension "sklearn.utils.murmurhash" sources
building extension "sklearn.utils.lgamma" sources
building extension "sklearn.utils.graph_shortest_path" sources
building extension "sklearn.utils.seq_dataset" sources
building extension "sklearn.utils.weight_vector" sources
building extension "sklearn.utils.random" sources
building extension "sklearn.utils._logistic_sigmoid" sources
building data_files sources
build_src: building npy-pkg config files
running build_py
running build_clib
customize UnixCCompiler
customize UnixCCompiler using build_clib
running build_ext
customize UnixCCompiler
customize UnixCCompiler using build_ext
resetting extension 'sklearn.svm.liblinear' language from 'f77' to 'c++'.
customize UnixCCompiler
customize UnixCCompiler using build_ext
customize GnuFCompiler
Could not locate executable g77
Could not locate executable f77
customize IntelFCompiler
Could not locate executable ifort
Could not locate executable ifc
customize LaheyFCompiler
Could not locate executable lf95
customize PGroupFCompiler
Could not locate executable pgf90
Could not locate executable pgf77
customize AbsoftFCompiler
Could not locate executable f90
customize NAGFCompiler
Could not locate executable f95
customize VastFCompiler
customize CompaqFCompiler
Could not locate executable fort
customize IntelItaniumFCompiler
Could not locate executable efort
Could not locate executable efc
customize IntelEM64TFCompiler
customize Gnu95FCompiler
Could not locate executable gfortran
customize G95FCompiler
Could not locate executable g95
customize PathScaleFCompiler
Could not locate executable pathf95
don't know how to compile Fortran code on platform 'posix'
warning: build_ext: f77_compiler=None is not available.

running scons
running install_lib
creating /usr/local/lib/python2.7/dist-packages/sklearn
error: could not create '/usr/local/lib/python2.7/dist-packages/sklearn': Permission denied

最佳答案

问题不在于 ATLAS 和 BLAS,而在于您需要成为 super 用户才能写入/usr 目录。
尝试

sudo  python setup.py install

另一种(可能更简单)的方法是直接从 ubuntu 存储库安装:
sudo apt-get install python-sklearn

关于python - 在 Ubuntu 中安装 scikit-learn 时遇到一些麻烦,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19725139/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com