目标:如何在Jupyter notebook已经安装了python3的基础上,安装python2,当使用Jupyter notebook时,可以选择任一版本运行。
解决步骤:
步骤1 安装 anaconda
步骤2 using conda, create a Python 2 environment:
conda create -n ipykernel_py2 python=2 ipykernel
source activate ipykernel_py2 # On Windows, remove the word ‘source’
python -m ipykernel install --user
步骤3 出现“No module named functools_lru_cache”
先卸载functools_lru_cache后再重新安装
$ pip uninstall backports.functools_lru_cache
$ pip install backports.functools_lru_cache
步骤4 再次执行步骤2
conda create -n ipykernel_py2 python=2 ipykernel
source activate ipykernel_py2 # On Windows, remove the word ‘source’
python -m ipykernel install --user
成功!!!