gpt4 book ai didi

python - Pylons 粘贴外壳无法在 ipython 中运行

转载 作者:行者123 更新时间:2023-11-28 23:04:42 25 4
gpt4 key购买 nike

我安装 ipython,然后运行 ./paster shell dev.ini命令,paster 打开标准 python 控制台。我怎样才能让它运行 ipython?

最佳答案

以下是我在 Fedora 17 上使用 IPython 0.12、paste-1.7.5.1 和 pylons 1.0 的工作方式:

$ 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 中的名称)。

关于python - Pylons 粘贴外壳无法在 ipython 中运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7389388/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com