我有一個安裝了Anaconda的Python 3,希望能夠在python2和3內核之間快速切換。這是在OSX上。Anaconda:IPython/Jupyter筆記本中的Python 3和2
我到此爲止涉及:
conda create -p ~/anaconda/envs/python2 python=2.7
source activate python2
conda install ipython
ipython kernelspec install-self
source deactivate
這之後,我有一個python2內核從python3 IPython的筆記本,但是它不能啓動選擇。
所以我繼續修改/usr/local/share/jupyter/kernels/python2/kernel.json
{
"display_name": "Python 2",
"language": "python",
"argv": [
"/Users/sonium/anaconda/envs/python2/bin/python",
"-m",
"IPython.kernel",
"-f",
"{connection_file}"
],
"env":{"PYTHONHOME":"~/anaconda/envs/python2/:~/anaconda/envs/python2/lib/"}
}
現在,當我開始python2內核它失敗:
ImportError: No module named site