2014-02-20 65 views
0

我嘗試使用沒有iPython,Canopy的enthought包。不使用Canopy導入Enthought包的錯誤

我下載traits,traitsui,enthought ... etc包。但是,當我將文件夾放在/ Lib中時,它會回調ctraits錯誤。

後,我從https://github.com/enthought/ctraits下載ctraits,

仍然有問題。當我輸入enthought.traits.api或trais.api

錯誤消息是

Traceback (most recent call last): 
File "<pyshell#0>", line 1, in <module> 
    import enthought.traits.api 
File "C:\Python27\lib\enthought\traits\api.py", line 3, in <module> 
from traits.api import * 
File "<pyshell#0>", line 1, in <module> 
    import enthought.traits.api 
File "C:\Python27\lib\enthought\traits\api.py", line 3, in <module> 
    from traits.api import * 
File "C:\Python27\lib\traits\api.py", line 107, in <module> 
    from traitsui import view_elements 
File "C:\Python27\lib\traitsui\view_elements.py", line 201, in <module> 
    class SearchStackItem (HasStrictTraits): 
File "C:\Python27\lib\traits\has_traits.py", line 426, in __new__ 
    mhto = MetaHasTraitsObject(cls, class_name, bases, class_dict, False) 
File "C:\Python27\lib\traits\has_traits.py", line 497, in __init__ 
    value = _check_trait(value) 
File "C:\Python27\lib\traits\has_traits.py", line 340, in _check_trait 
    return trait.as_ctrait() 
File "C:\Python27\lib\traits\trait_handlers.py", line 597, in as_ctrait 
    trait.set_validate(validate) 
File "C:\Python27\lib\traits\ctraits.py", line 714, in set_validate 
    raise ValueError("The argument must be a tuple or callable") 
ValueError: The argument must be a tuple or callable 

沒有人有相關經驗,使用特點,Enthought包沒有雨棚或IPython的?

回答

1

要安裝ETS,最好的鏈接是http://code.enthought.com/downloads/。如果您不想安裝Canopy,最簡單的方法是使用pip或easy_install從PyPI安裝Traits。最手動的方式需要你克隆整個庫(在https://github.com/enthought/traits),並與

python setup.py develop 

此建造它需要一個C編譯器。下載單個文件並手動放置這些文件很可能會失敗。

最後一點:在enthought命名空間已被棄用,現在你可以/應該簡單地導入特徵,traitsui或查科直接,例如:

from traits.api import HasTraits 

希望這有助於。