2014-10-17 2 views
0

Я хотел бы импортировать шалфея и sklearn модули, но когда я пытаюсь импортировать их как шалфей шоу ImportError:Импорт skitlean модуль питона с шалфеем

$ sage -python temp.py 
Traceback (most recent call last): 
    File "temp.py", line 2, in <module> 
    from sklearn import * 
ImportError: No module named sklearn 

Все sklean модули уже установлены:

$ ipython2 
In [1]: from sklearn import * 
/usr/lib/python2.7/site-packages/sklearn/pls.py:7: DeprecationWarning: 
This module has been moved to cross_decomposition and will be removed in 0.16 
"removed in 0.16", DeprecationWarning) 

$ ipython3 
In [1]: from sklearn import * 
/usr/lib/python3.4/site-packages/sklearn/pls.py:7: DeprecationWarning: 
This module has been moved to cross_decomposition and will be removed in 0.16 
"removed in 0.16", DeprecationWarning) 

ответ

2

Я ставлю довольно большой стек мини-пончиков, который у вас его нет в вашей Sage версии Python.

$ sage -ipython 
Python 2.7.5 (default, May 6 2014, 09:27:46) 
Type "copyright", "credits" or "license" for more information. 

IPython 1.2.1 -- An enhanced Interactive Python. 
?   -> Introduction and overview of IPython's features. 
%quickref -> Quick reference. 
help  -> Python's own help system. 
object? -> Details about 'object', use 'object??' for extra details. 

In [1]: from sklearn import * 
--------------------------------------------------------------------------- 
ImportError        Traceback (most recent call last) 
<ipython-input-1-d78f0aaa3480> in <module>() 
----> 1 from sklearn import * 

ImportError: No module named sklearn 

In [2]: 

Предполагая, что у вас уже есть pip, я бы

$ sage -sh 

Starting subshell with Sage environment variables set. Don't forget 
to exit when you are done. Beware: 
* Do not do anything with other copies of Sage on your system. 
* Do not use this for installing Sage packages using "sage -i" or for 
    running "make" at Sage's root directory. These should be done 
    outside the Sage shell. 

Bypassing shell configuration files... 

Note: SAGE_ROOT=... 
(sage-sh) :~$ 

, а затем вы можете установить sklearn там. Вам нужно сделать команду оболочки Sage, потому что иначе она не подберет правильные переменные среды для правильной установки. Как только вы это сделали, вы должны быть добрым.

 Смежные вопросы

  • Нет связанных вопросов^_^