Rename the conda virtual environment

Rename the conda virtual environment

Windows下,直接到\Anaconda3\envs下面重命名文件名(环境名)就可以了,其他系统还没尝试。
比如我要更改的conda环境所在目录位置为:D:\SoftWare_Install\Anaconda\envs\Geo

However, starting jupyter notebook after simply renaming may cause a kernel error problem.
insert image description here
This is because although the environment directory name has been changed, the calling command in the startup file has not been changed. The solution is as follows:

# 参考:https://blog.csdn.net/weixin_41640583/article/details/86545154

# 1,首先在cmd 使用jupyter kernelspec list查看安装的内核和位置
jupyter kernelspec list
# Available kernels:
# python3    D:\SoftWare_Install\Anaconda\envs\Geo\share\jupyter\kernels\python3
# 上面就是我的内核和位置

# 2. 进入安装内核目录打开kernel.jason文件,查看Python编译器的路径是否正确
# 我的内容如下:
{
    
    
 "argv": [
  "D:/SoftWare_Install/Anaconda/envs/py37\\python.exe",
  "-m",
  "ipykernel_launcher",
  "-f",
  "{connection_file}"
 ],
 "display_name": "Python 3 (ipykernel)",
 "language": "python",
 "metadata": {
    
    
  "debugger": true
 }
}
# 我之前的环境目录名是“py37”,现在已经改成“Geo”了,所以将这里的"D:/SoftWare_Install/Anaconda/envs/py37\\python.exe",改为"D:/SoftWare_Install/Anaconda/envs/Geo\\python.exe"

as the picture shows:
insert image description here

Guess you like

Origin blog.csdn.net/LIWEI940638093/article/details/125068687