Make pycharm use the real ipython console

2019-06-01 13:03发布

问题:

In pycharm, the ipython console does not seem to be a real ipython console.

In pycharm ipython console:

In[1]: ?sorted
{'text/plain': 'Signature: sorted(iterable, key=None, reverse=False)\nDocstring:\nReturn a ne

In a real ipython console:

In [5]: ?sorted
Signature: sorted(iterable, key=None, reverse=False)
Docstring:
Return a new list containing all items from the iterable in ascending order.

A custom key function can be supplied to customise the sort order, and the
reverse flag can be set to request the result in descending order.
Type:      builtin_function_or_method

I saw some other differences: does not load ipython profile, different behavior when using shortcut to get back previous commands

Is there anyway to have a real ipython console in pycharm? And that this console is still compatible with the shortcuts to run the selected code in the console.

回答1:

Could it be, that you're using different virtual environments/python versions in PyCharm and locally? That could perfectly explain differences in the outputs.

Can you run this code in both and compare the output:

import IPython; IPython.version_info

EDIT

Confirmed, PyCharm converts the output of the ipython even if the versions are the same.