1-minifoge+vscode+jupyter环境配置
2023-11-24 本文已影响0人
yefang
该文章仅供学习参考
相信很多小伙伴发现因为各种原因,公司里面没办法使用正版的商用anaconda了,
这篇文章将交大家怎么用免费的miniforge+vscode配置python的环境。
关于miniforge的介绍详见https://zhuanlan.zhihu.com/p/379567315
1.下载miniforge
下载地址详见https://github.com/conda-forge/miniforge
根据自己电脑的系统选择下载安装包

下载完成后打开安装包自己往后点就完事了,记得【安装路径装到自己喜欢的盘】,后面要用,小本本记下来

2.打开miniforge配置虚拟环境,安装Jupyter notebook
2.0搜索miniforge

2.1创建虚拟环境
conda create -n py39 python==3.9

如遇http错误可以尝试关闭ssl防火墙
conda config --set ssl_verify false
确认并回车

2.2激活虚拟环境
activate py39
2.3安装Jupyter notebook
mamba install -c conda-forge notebook


下载完成命令行界面输入
jupyter notebook
后即可使用,如果需要用起来更舒服可以搭配vscode,请接着往下读
3.vscode+miniforge环境的jupyter
3.0安装vscode
下载地址:https://code.visualstudio.com/,下完打开安装包一直往下点
3.1安装你喜欢的扩展
比如文化自信的中文扩展

3.2连接miniforge的虚拟环境
打开【文件】找到【设置】

找到Python和Default Interpreter Path

3.3将安装虚拟环境的地址填入
找到你安装miniforge的路径,我的是下面这个,你的不一定是这个得自己找
C:\Users\yefan\miniforge3\envs\py39\python.exe
把这个填到下面去


Conda Path 最好也填一下,我的是下面这个,你的不一定是这个得自己找
C:\Users\yefan\miniforge3\pythonw.exe

3.4测试一下ipynb能不能用
选择刚刚的虚拟环境

print('Hello World')

Done~