我在安装 Ipython 时遇到了麻烦,幸好我尝试了 3.2.1 版本,一切正常,我可以运行 Ipython,但我仍然无法运行 Ipython 笔记本。
$ ipython
Python 2.7.9 (default, Apr 2 2015, 15:33:21)
Type "copyright", "credits" or "license" for more information.
IPython 3.2.1 -- An enhanced Interactive Python.
$ ipython notebook
...
ImportError: IPython.html requires pyzmq >= 13
我尝试安装 pyzmq 但出现以下错误:
$ sudo pip install -U pyzmq
...
Warning: Failed to build or run libzmq detection test.
If you expected pyzmq to link against an installed libzmq, please check to make sure:
* You have a C compiler installed
* A development version of Python is installed (including headers)
* A development version of ZMQ >= 2.1.4 is installed (including headers)
* If ZMQ is not in a default location, supply the argument --zmq=<path>
* If you did recently install ZMQ to a default location,
try rebuilding the ld cache with `sudo ldconfig`
or specify zmq's location with `--zmq=/usr/local`
...
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
我只复制了错误,因为 shell 执行了数百行代码。
信息:Python 版本 2.7.9
我有 Anaconda,(不知道它是否会改变任何东西)Ubuntu 15.04 我有 Canopy(Python IDE)(不知道它是否会改变任何东西)
编辑:我尝试了一些其他的东西,然后决定尝试安装 jupyter。我注意到,即使在全新安装(使用 pip)后,我也无法运行 jupyter。
$ jupyter notebook
jupyter : command not found.
但现在我可以运行:
~$ ipython notebook
[I 00:33:30.336 NotebookApp] Writing notebook server cookie secret to /run/user/1000/jupyter/notebook_cookie_secret
[I 00:33:30.386 NotebookApp] Serving notebooks from local directory: /home/renanpc
[I 00:33:30.386 NotebookApp] 0 active kernels
[I 00:33:30.386 NotebookApp] The IPython Notebook is running at: http://localhost:8888/
[I 00:33:30.386 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
(process:11118): GLib-CRITICAL **: g_slice_set_config: assertion 'sys_page_size == 0' failed
^C[I 00:37:24.548 NotebookApp] interrupted
Serving notebooks from local directory: /home/renanpc
0 active kernels
The IPython Notebook is running at: http://localhost:8888/
笔记本运行正常。我对这种情况非常困惑。
答案1
我遇到过同样的问题您应该尝试以下操作:哪个 ipython - 在我的情况下我得到 - “/opt/local/bin/ipython”然后 ls -l /opt/local/bin/ipython 这将向您显示链接指向的位置“lrwxr-xr-x 1 root admin 71B 11 фев 17:49 /opt/local/bin/ipython@ -> /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/ipython”现在 ls /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/ - 如果您在输出中看到 jupyter - 只需执行以下操作:ln -s /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/jupyter /opt/local/bin/