原因:原来安装在/目录,现在不允许
方案:
首先从迁移的项目中移动到/Users/yourname/下
/Users/yourname/anaconda3/conda中修改
from
!/anaconda3/bin/python
to
!/Users/yourname/anaconda3/bin/python
同理 对~/.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
运行几遍,如果jupyter notebook 起不来的话,更新一下
conda update --prefix /Users/yourname/anaconda3 anaconda
这里,因为anaconda迁移了位置,所以kernel的path也要更新在/Users/yourname/anaconda3/share/jupyter/kernels/
下创建文件夹python2或者python3(如果有直接cd进入),修改或新建kernel.json,内容如下
{
"display_name": "Python 2",
"language": "python",
"argv": [
"/Users/yourname/anaconda3/envs/kf/bin/python",
"-m",
"ipykernel_launcher",
"-f",
"{connection_file}"
]
}
以上便可以更改anaconda位置后启动jupyter notebook了
部分错误如下:
FileNotFoundError: [Errno 2] No such file or directory: '~/anaconda3/envs/kf/bin/python'
bad interpreter: /anaconda3/bin/python: no such file or directory
网友评论