2015-10-14 14 views
1

我今天安裝了Jupyter(iPython),並且能夠在瀏覽器中啓動Notebook並將其連接到筆記本服務器。我能夠在細胞中執行Python代碼以及但是當我嘗試使用神奇的方法,如%timeit或%HIST我得到一個錯誤Jupyter(iPython)註冊爲str而不是可調用的神奇方法

「海峽」對象不是可調用

我在MagicsManager中打印出魔法['line']對象,它顯示魔法對的值是一個字符串而不是可調用的東西。爲什麼會發生?

Looking for line magic timeit 
{'load': 'load', 'psource': 'psource', 'lsmagic': 'lsmagic', 'logstart': 'logstart', 'popd': 'popd', 'loadpy': 'loadpy', 'ls': <alias ls for 'ls -F --color'>, 'install_ext': 'install_ext', 'cd': 'cd', 'pastebin': 'pastebin', 'colors': 'colors', 'prun': 'prun', 'cp': <alias cp for 'cp'>, 'lk': <alias lk for 'ls -F -o --color %l | grep ^l'>, 'who_ls': 'who_ls', 'lf': <alias lf for 'ls -F -o --color %l | grep ^-'>, 'install_profiles': 'install_profiles', 'autocall': 'autocall', 'ldir': <alias ldir for 'ls -F -o --color %l | grep /$'>, 'bookmark': 'bookmark', 'connect_info': 'connect_info', 'll': <alias ll for 'ls -F -o --color'>, 'pprint': 'pprint', 'mkdir': <alias mkdir for 'mkdir'>, 'system': 'sx', 'automagic': 'automagic', 'whos': 'whos', 'rerun': 'rerun', 'rmdir': <alias rmdir for 'rmdir'>, 'save': 'save', 'tb': 'tb', 'lx': <alias lx for 'ls -F -o --color %l | grep ^-..x'>, 'more': 'less', 'pylab': 'pylab', 'pdef': 'pdef', 'killbgscripts': 'killbgscripts', 'precision': 'precision', 'quickref': 'quickref', 'pinfo': 'pinfo', 'pwd': 'pwd', 'psearch': 'psearch', 'autosave': 'autosave', 'reset': 'reset', 'magic': 'magic', 'dhist': 'dhist', 'edit': 'edit', 'logstop': 'logstop', 'gui': 'gui', 'xdel': 'xdel', 'xmode': 'xmode', 'cat': <alias cat for 'cat'>, 'alias_magic': 'alias_magic', 'store': 'store', 'man': 'man', 'recall': 'recall', 'debug': 'debug', 'logon': 'logon', 'page': 'page', 'history': 'history', 'profile': 'profile', 'logstate': 'logstate', 'ed': <IPython.core.magic.MagicAlias object at 0x7f7a7113d6d0>, 'pycat': 'pycat', 'pushd': 'pushd', 'timeit': 'timeit', 'set_env': 'set_env', 'unalias': 'unalias', 'rehashx': 'rehashx', 'hist': <IPython.core.magic.MagicAlias object at 0x7f7a7113d490>, 'install_default_config': 'install_default_config', 'mv': <alias mv for 'mv'>, 'env': 'env', 'qtconsole': 'qtconsole', 'load_ext': 'load_ext', 'rm': <alias rm for 'rm'>, 'config': 'config', 'dirs': 'dirs', 'run': 'run', 'reset_selective': 'reset_selective', 'pfile': 'pfile', 'pinfo2': 'pinfo2', 'who': 'who', 'matplotlib': 'matplotlib', 'less': 'less', 'notebook': 'notebook', 'unload_ext': 'unload_ext', 'doctest_mode': 'doctest_mode', 'sx': 'sx', 'macro': 'macro', 'clear': 'clear', 'pdb': 'pdb', 'alias': 'alias', 'logoff': 'logoff', 'reload_ext': 'reload_ext', 'time': 'time', 'sc': 'sc', 'rep': <IPython.core.magic.MagicAlias object at 0x7f7a7113d550>, 'pdoc': 'pdoc'} 
built_in trap: 
args= [u''] 
kwargs= {} 
fn= timeit <type 'str'> 
str object timeit is not callable... 

回答

2

我刪除了所有單獨安裝的軟件包,而是做了以下內容:

  1. 創建機器上pip2pi本地回購與互聯網連接pip2pi . --no-use-wheel jupyter
  2. SCP-ED創造了回購的zip文件在第一步到我想要的機器(這臺機器沒有互聯網接入,因此我不得不在不同的機器上使用pip2pi)(scp-ed爲ipython_stuff.zip)
  3. 使用pip install --index-url=file:///var/tmp/ipython_stuff/simple jupyter安裝

運行jupyter notebook這次工作,所以我想問題是或者缺少依賴或不正確的版本,因爲我已經手動安裝所有的依賴關係,一個接一個。使用pip2pi避免了由於缺乏互聯網連接而無法使用點的問題,並確保下載具有正確版本的所有軟件包。

相關問題