我在安裝 Ipython 時遇到了麻煩,但幸運的是我嘗試了 3.2.1 版本,一切正常,我可以運行 Ipython,但我仍然無法運行 Ipython Notebook。
$ 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
我也遇到了同樣的問題你應該嘗試以下操作:which 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/ " 現在ls /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/ - 如果您在輸出中看到jupyter - 只需執行以下操作: ln -s /opt/local/Library/Frameworks/ Python。