我安裝ipython,然後我運行 ./paster shell dev.ini
命令,paster打開標準的python控制檯。我怎樣才能讓它運行ipython?pylons paster shell不能在ipython中運行
回答
我解決了這個問題降級IPython的到版本0.10
你嘗試從Pylons Quick Site Development步驟:
13.1.2使用一個IPython的嵌入式外殼
IPython都提供了一個更強大的交互式提示和一個功能強大的嵌入式 外殼。如果您是一名Python程序員,並且尚未嘗試IPython,那麼您絕對應該研究它。
首先,從IPython的進口 - 添加像在 頂部控制器模塊的下面,在我們的例子中 firstapp /控制器/ firstcontroller.py:
從IPython.Shell進口IPShellEmbed ARGS = ['-pdb','-pi1',' < \#>:','-pi2','。\ D .:', '-po','Out < \#:','' 'nipsp'] ipshell = IPShellEmbed(args, )banner ='進入IPython。按Ctrl-D退出', exit_msg ='離開翻譯器,回到Pylons。')
然後,將這個代碼在動作/方法:
ipshell(「我們在行動ABC」)
返回到主塔,然後繼續按 按Ctrl-d響應請求。
需要注意的是,由於 IPython.Shell.IPShellEmbed的一些特質的功能,我不得不把以下各之前調用 到ipshell():
ipshell.IP.exit_now =假ipshell(「我們是在動作ABC')
是否有您的IPython是全球安裝任何機會,但你從virtualenv是--no-site-packages
運行掛架?如果是這種情況,那麼掛架將不會看到您的ipython安裝。
Ipython最近更新至版本.11。某些組件不再正常工作,特別是第三方庫。檢查掛架的郵件列表,你可能想考慮一個錯誤報告。
下面是它如何與IPython的0.12,糊1.7.5.1和塔1.0爲我工作在Fedora 17:
$ paster shell dev.ini
Pylons Interactive Shell
Python 2.7.3 (default, Jul 24 2012, 10:05:38)
[GCC 4.7.0 20120507 (Red Hat 4.7.0-5)]
All objects from project.lib.base are available
Additional Objects:
mapper - Routes mapper object
wsgiapp - This project's WSGI App instance
app - paste.fixture wrapped around wsgiapp
>>> __name__ = '__main__'
>>> import IPython
>>> IPython.embed()
Python 2.7.3 (default, Jul 24 2012, 10:05:38)
Type "copyright", "credits" or "license" for more information.
IPython 0.12 -- 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]:
重置__name__
是必要的因爲任何一個Pylons/Paste設置__name__
到"pylons-admin"
會讓IPython混淆(它會嘗試在sys.modules
的名稱中查找主模塊的名稱)。
這似乎是工作,爲什麼它downvoted? –
試試這個:
paster ishell dev.ini
- 1. ipython 0.10.2與turbogears paster shell墜毀
- 2. python 3 django shell ipython bug。 ipython shell不會運行
- 3. 從shell和iPython運行
- 4. 在reddit.com上執行「paster shell example.ini」時出錯
- 5. Paster需要從程序目錄運行?
- 6. Mayavi/IPython shell不能預期的行爲
- 7. 當我運行python manage.py shell時,Django shell將不會使用ipython
- 8. 運行ipython shell的Web界面
- 9. IPython 4 shell不能與Sublime REPL
- 10. 如何在IPython中運行shell命令? (Python分析GUI工具)
- 11. 在Jupyter中運行Cython iPython
- 12. 在腳本中運行IPython
- 13. 不能在shell腳本運行NPM
- 14. 不能在PHP運行shell腳本
- 15. Ipython? Shell
- 16. python:是否有可能檢測到我是否在paster shell?
- 17. Cmd鍵不能在Jupyter for iPython中運行
- 18. 運行paster時出現語法錯誤?
- 19. Python os.system('python')只能在shell中運行
- 20. 命令在交互式shell中運行,但不在shell腳本中運行
- 21. Pylons漂亮的錯誤處理去了哪裏?使用Nginx + Paster + Flup#fcgi_thread
- 22. Cron不能正確運行shell腳本
- 23. 不能在Enthought Canopy下運行ipython筆記本
- 24. 如何在Pyspark中運行腳本並在完成後放入IPython shell?
- 25. 不能在ipython筆記本中使用/導入MySQLdb(在ipython qtconsole中運行良好)
- 26. PowerShell中的IPython Shell命令
- 27. 在Ipython中運行/導入腳本
- 28. 代碼在shell中運行,但不是從模塊中運行
- 29. Linux:在子shell中運行
- 30. 在Maemo中運行bash shell
謝謝你的分享,你救了我頭疼 – neurino
太糟糕了0.10有嚴重的unicode問題... –