Jupyter Notebook - install python 2

百般思念 提交于 2021-01-28 05:07:30

问题


EDITED

I'm very new to python and have a probably super basic question. I've installed Jupyter Notebook by installing anaconda which includes python 3 by default. Now I want to use an external toolbox which still works with python 2.7, so I'm trying to get e kernel with python 2.7 as suggested here. In the Anaconda Prompt I'm typing

python2 -m pip install ipykernel
python2 -m ipykernel install --user

But it says that it couldn't find the command "python2". Any idea?


回答1:


I had the same issue. You can try starting jupyter-notebook from python2

$ python2 /path/to/jupyter-notebook

in my case running python2 /usr/bin/jupyter-notebook fixed the issue.

shebang in my case

$ head -1 /usr/bin/jupyter-notebook
#!/usr/bin/python3.4
$



回答2:


Have you tried looking at the Jupyter Notebook homepage?

Just use

pip install jupyter

or

pip install jupyter --user



回答3:


I still don't know why it doesn't work, but i found out what worked instead. Using

conda create -n ipykernel_py2 python=2 ipykernel
activate ipykernel_py2    
python -m ipykernel install --user

in the Anaconda Prompt added the option to open a python 2 notebook in the Jupyter Notebook. Also I can change the Kernel now to python 2.



来源:https://stackoverflow.com/questions/46391424/jupyter-notebook-install-python-2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!