简体   繁体   English

Intellij的想法没有正确运行IPython笔记本

[英]Intellij idea does not run IPython notebook properly

i have conda installation with python 2.7.10 in windows 8, with installed ipython notebook and jupyter. 我在Windows 8中安装了带有python 2.7.10的conda,安装了ipython notebook和jupyter。 when i try to run ipython notebook from console? 当我尝试从控制台运行ipython笔记本时? it runs just ok. 它运行正常。 but from intellij idea i receive an error, like it doesn't see notebook installments: 但是从intellij的想法我收到一个错误,就像它没有看到笔记本分期付款:

path\\to\\python\\Miniconda3\\envs\\py27\\python.exe path\\to.IntelliJIdea14\\config\\plugins\\python\\helpers\\pycharm\\pycharm_load_entry_point.py notebook --no-browser --ip 127.0.0.1 --port 8888 path \\ to \\ python \\ Miniconda3 \\ envs \\ py27 \\ python.exe path \\ to.IntelliJIdea14 \\ config \\ plugins \\ python \\ helpers \\ pycharm \\ pycharm_load_entry_point.py notebook --no-browser --ip 127.0.0.1 --port 8888

Traceback (most recent call last): File "path\\to.IntelliJIdea14\\config\\plugins\\python\\helpers\\pycharm\\pycharm_load_entry_point.py", line 8, in load_entry_point(dist, "console_scripts", name)() 回溯(最近一次调用最后一次):文件“path \\ to.IntelliJIdea14 \\ config \\ plugins \\ python \\ helpers \\ pycharm \\ pycharm_load_entry_point.py”,第8行,在load_entry_point(dist,“console_scripts”,name)()

File "path\\topython\\Miniconda3\\envs\\py27\\lib\\site-packages\\setuptools-18.3.2-py2.7.egg\\pkg_resources__init__.py", line 558, in load_entry_point 在load_entry_point中输入文件“path \\ topython \\ Miniconda3 \\ envs \\ py27 \\ lib \\ site-packages \\ setuptools-18.3.2-py2.7.egg \\ pkg_resources__init __。py”,第558行
File "path\\topython\\Miniconda3\\envs\\py27\\lib\\site-packages\\setuptools-18.3.2-py2.7.egg\\pkg_resources__init__.py", line 2681, in load_entry_point ImportError: Entry point ('console_scripts', 'ipython') not found 文件“path \\ topython \\ Miniconda3 \\ envs \\ py27 \\ lib \\ site-packages \\ setuptools-18.3.2-py2.7.egg \\ pkg_resources__init __。py”,第2681行,在load_entry_point中ImportError:入口点('console_scripts','找不到ipython')

i've tried to make it work several times, console and ide concurrently, and once in a time it did run in ide too, but after succesful shutdown it doesn't run again. 我试图让它工作几次,控制台和ide同时进行,并且曾经一次在ide中运行,但是在成功关闭后它不再运行。 What could be a problem? 可能有什么问题?

# packages in environment at path\\to\\python\\Miniconda3\\envs\\py27: 在path \\ to \\ python \\ Miniconda3 \\ envs \\ py27中的环境中的#包:

#

jupyter-client 4.0.0 jupyter-client 4.0.0

jupyter-core 4.0.6 jupyter-core 4.0.6

jupyter_client 4.0.0 py27_0 jupyter_client 4.0.0 py27_0

jupyter_core 4.0.6 py27_0 jupyter_core 4.0.6 py27_0

[py27] conda list ipython [py27] conda list ipython

# packages in environment at path\\to\\python\\Miniconda3\\envs\\py27: # 在path \\ to \\ python \\ Miniconda3 \\ envs \\ py27的环境中的#包:#

ipython 4.0.0 py27_0 ipython 4.0.0 py27_0

ipython-genutils 0.1.0 ipython-genutils 0.1.0

ipython-notebook 4.0.4 py27_0 ipython-notebook 4.0.4 py27_0

ipython-qtconsole 4.0.1 py27_0 ipython-qtconsole 4.0.1 py27_0

ipython_genutils 0.1.0 py27_0 ipython_genutils 0.1.0 py27_0

could jupyter install be a problem? jupyter安装会有问题吗?

As far as I can tell this is a problem with Intellij IDEA and not with Jupyter. 据我所知,这是Intellij IDEA的问题,而不是Jupyter的问题。

I'm having the exact same problem with Intellij IDEA 14.1.5 using Anaconda with Jupyter Notebook installed. 我使用安装了Jupyter笔记本的Anaconda与Intellij IDEA 14.1.5完全相同的问题。 However when I attempt to start Ipython Notebook in pyCharm it works fine (Though I had to downgrade to Ipython 3.2.1, but that is an entirely unrelated issue, just mentioning it in case it happens to you). 然而,当我尝试在pyCharm中启动Ipython Notebook时,它运行正常(虽然我不得不降级到Ipython 3.2.1,但这是一个完全不相关的问题,只要提到它就会发生这种情况)。

As for a solution: 至于解决方案:

Just replace the content of {config_dir}.IntelliJIdea14\\config\\plugins\\python\\helpers\\pycharm\\pycharm_load_entry_point.py with the following code: 只需使用以下代码替换{config_dir} .IntelliJIdea14 \\ config \\ plugins \\ python \\ helpers \\ pycharm \\ pycharm_load_entry_point.py的内容:

import os, sys
from pkg_resources import load_entry_point

if __name__ == '__main__':
  dist = os.environ.get("PYCHARM_EP_DIST")
  name = os.environ.get("PYCHARM_EP_NAME")
  if dist == "ipython" and name == "ipython":
    from IPython import start_ipython
    f = start_ipython
  else:
    f = load_entry_point(dist, "console_scripts", name)
  sys.exit(f())

I found this hack by chance on github . 我在github上偶然发现了这个黑客攻击。 Not sure if you can rely on it though, it may be overwritten by future updates. 不确定您是否可以依赖它,它可能会被未来的更新覆盖。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM