Ao executar python3 setup.py build
, ele terminou com isso:
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.4/sklearn/linear_model/sag_fast.o -Lbuild/temp.linux-x86_64-3.4 -o build/lib.linux-x86_64-3.4/sklearn/linear_model/sag_fast.cpython-34m.so
running install_lib
creating /usr/local/lib/python3.4/dist-packages/sklearn
error: could not create '/usr/local/lib/python3.4/dist-packages/sklearn': Permission denied
É claro que não foi possível gravar em /usr/local/lib/
, já que não foi usado sudo
. Tenho receio de usar o sudo para este passo.
Este foi o fim de sudo python3 setup.py install
:
running install_egg_info
Writing /usr/local/lib/python3.4/dist-packages/scikit_learn-0.18.dev0.egg-info
running install_clib
Parece bom para mim. No entanto, quando tento import sklearn
, recebo este erro:
$ python3
Python 3.4.3+ (default, Oct 14 2015, 16:03:50)
[GCC 5.2.1 20151010] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sklearn
Traceback (most recent call last):
File "/home/dotancohen/code/scikit-learn/sklearn/__check_build/__init__.py", line 44, in <module>
from ._check_build import check_build
ImportError: No module named 'sklearn.__check_build._check_build'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/dotancohen/code/scikit-learn/sklearn/__init__.py", line 56, in <module>
from . import __check_build
File "/home/dotancohen/code/scikit-learn/sklearn/__check_build/__init__.py", line 46, in <module>
raise_build_error(e)
File "/home/dotancohen/code/scikit-learn/sklearn/__check_build/__init__.py", line 41, in raise_build_error
%s""" % (e, local_dir, ''.join(dir_content).strip(), msg))
ImportError: No module named 'sklearn.__check_build._check_build'
___________________________________________________________________________
Contents of /home/dotancohen/code/scikit-learn/sklearn/__check_build:
_check_build.c setup.pyc __pycache__
_check_build.pyx __init__.py setup.py
___________________________________________________________________________
It seems that scikit-learn has not been built correctly.
If you have installed scikit-learn from source, please do not forget
to build the package before using it: run 'python setup.py install' or
'make' in the source directory.
If you have used an installer, please check that it is suited for your
Python version, your operating system and your platform.
>>>
Devo rodar python3 setup.py build
com sudo
? Isso está no Kubuntu Linux 15.10:
$ uname -a
Linux loathe 4.2.0-16-generic #19-Ubuntu SMP Thu Oct 8 15:35:06 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
$ cat /etc/issue
Ubuntu 15.10 \n \l
Note que a versão do python-scikits-learn
em pacote do Ubuntu é somente para o Python 2, e eu preciso do Python 3.