1

一些版本信息:

OS: Mac OS X 10.8.4
Python: 2.7.2 (that came with the Mac OS X)
PyPy: 2.0.2
iPython: 0.13.2
PyCharm: 2.5.1

当 PyPy 和 iPython 在 vi​​rtualenv 创建的项目中共存时,PyCharm 的 Python 控制台会失败。

图片

我创建了三个虚拟环境项目。我没有激活任何虚拟环境。所以,系统python仍然存在。

环境 - 1:

$ virtualenv -p /path/to/system/installed/python /path/to/sample_1/virtualenv/project
$ /path/to/sample_1/virtualenv/project/bin/pip install ipython

现在,当我在 PyCharm 中运行 python 控制台时,它工作正常。(PyCharm 中的解释器设置为 /path/to/sample_1/virtualenv/project/bin/python)

环境 - 2:

$ virtualenv -p /path/to/pypy /path/to/sample_2/virtualenv/project

现在,当我在 PyCharm 中运行 python 控制台时,它工作正常。(PyCharm 中的解释器设置为 /path/to/sample_2/virtualenv/project/bin/python)

环境 - 3:

$ virtualenv -p /path/to/pypy /path/to/sample_3/virtualenv/project
$ /path/to/sample_3/virtualenv/project/bin/pip install ipython

现在,当我在 PyCharm 中运行 python 控制台时,它失败并出现以下错误。(PyCharm 中的解释器设置为 /path/to/sample_3/virtualenv/project/bin/python)

/path/to/sample_3/virtualenv/project/bin/pypy -u /Applications/PyCharm.app/helpers/pydev/pydevconsole.py 60355 60356
PyDev console: using IPython 0.13.2
Traceback (most recent call last):
  File "app_main.py", line 72, in run_toplevel
  File "/Applications/PyCharm.app/helpers/pydev/pydevconsole.py", line 361, in <module>
    StartServer(pydev_localhost.get_localhost(), int(port), int(client_port))
  File "/Applications/PyCharm.app/helpers/pydev/pydevconsole.py", line 288, in StartServer
    interpreter = InterpreterInterface(host, client_port, threading.currentThread())
  File "/Applications/PyCharm.app/helpers/pydev/pydev_ipython_console.py", line 37, in __init__
    self.interpreter = PyDevFrontEnd()
  File "/Applications/PyCharm.app/helpers/pydev/pydev_ipython_console_011.py", line 35, in __init__
    shell = TerminalInteractiveShell.instance()
  File "/path/to/sample_3/virtualenv/project/site-packages/IPython/config/configurable.py", line 318, in instance
    inst = cls(*args, **kwargs)
  File "/path/to/sample_3/virtualenv/project/site-packages/IPython/frontend/terminal/interactiveshell.py", line 360, in __init__
    user_module=user_module, custom_exceptions=custom_exceptions
  File "/path/to/sample_3/virtualenv/project/site-packages/IPython/core/interactiveshell.py", line 454, in __init__
    self.init_readline()
  File "/path/to/sample_3/virtualenv/project/site-packages/IPython/core/interactiveshell.py", line 1843, in init_readline
    self.refill_readline_hist()
  File "/path/to/sample_3/virtualenv/project/site-packages/IPython/core/interactiveshell.py", line 1851, in refill_readline_hist
    self.readline.clear_history()
  File "/tmp/pypy-2.0.2/lib_pypy/pyrepl/readline.py", line 284, in clear_history
    del self.get_reader().history[:]
  File "/tmp/pypy-2.0.2/lib_pypy/pyrepl/readline.py", line 188, in get_reader
    console = UnixConsole(self.f_in, self.f_out, encoding=ENCODING)
  File "/tmp/pypy-2.0.2/lib_pypy/pyrepl/unix_console.py", line 98, in __init__
    curses.setupterm(term, self.output_fd)
error: setupterm: could not find terminfo database

Process finished with exit code 1

请注意,任何虚拟环境中的 bin/python 都指向已安装的解释器。例如,/path/to/sample_3/virtualenv/project/bin/python 指向 pypy,/path/to/sample_1/virtualenv/project/bin/python 指向系统安装的 python。

似乎这与有关。但是,我不确定。

请帮忙。

4

1 回答 1

0

查看实际的异常消息,这可能是一个潜在的解决方案:

https://support.enthought.com/entries/22438744-Linux-IPython-in-terminal-error-setupterm-could-not-find-terminfo-database-

Meanwhile, you should be able to work around the problem by setting
 export TERM="xterm-256color" in the shell from which you execute ipython,
or in your~/.bashrc file, which you then source.
于 2014-04-09T18:24:58.393 回答