原因:原來安裝在/目錄,現(xiàn)在不允許
方案:
首先從遷移的項(xiàng)目中移動(dòng)到/Users/yourname/下
/Users/yourname/anaconda3/conda中修改
from
!/anaconda3/bin/python
to
!/Users/yourname/anaconda3/bin/python
同理 對(duì)~/.bash_profile
from
export PATH="/anaconda3/bin:$PATH"
to
export PATH="/Users/yourname/anaconda3/bin:$PATH"
conda init bash 或者 conda init zsh
$ conda init bash
no change /Users/yourname/anaconda3/condabin/conda
no change /Users/yourname/anaconda3/bin/conda
no change /Users/yourname/anaconda3/bin/conda-env
no change /Users/yourname/anaconda3/bin/activate
no change /Users/yourname/anaconda3/bin/deactivate
no change /Users/yourname/anaconda3/etc/profile.d/conda.sh
no change /Users/yourname/anaconda3/etc/fish/conf.d/conda.fish
no change /Users/yourname/anaconda3/shell/condabin/Conda.psm1
no change /Users/yourname/anaconda3/shell/condabin/conda-hook.ps1
no change /Users/yourname/anaconda3/lib/python3.6/site-packages/xontrib/conda.xsh
no change /Users/yourname/anaconda3/etc/profile.d/conda.csh
modified /Users/yourname/.bash_profile
運(yùn)行幾遍,如果jupyter notebook 起不來的話,更新一下
conda update --prefix /Users/yourname/anaconda3 anaconda
這里,因?yàn)閍naconda遷移了位置,所以kernel的path也要更新在/Users/yourname/anaconda3/share/jupyter/kernels/
下創(chuàng)建文件夾python2或者python3(如果有直接cd進(jìn)入),修改或新建kernel.json,內(nèi)容如下
{
"display_name": "Python 2",
"language": "python",
"argv": [
"/Users/yourname/anaconda3/envs/kf/bin/python",
"-m",
"ipykernel_launcher",
"-f",
"{connection_file}"
]
}
以上便可以更改anaconda位置后啟動(dòng)jupyter notebook了
部分錯(cuò)誤如下:
FileNotFoundError: [Errno 2] No such file or directory: '~/anaconda3/envs/kf/bin/python'
bad interpreter: /anaconda3/bin/python: no such file or directory