- 这里使用anaconda自带的Jupyter Netbook,虚拟环境默认是anaconda下的python3虚拟环境。
- cmd输入命令jupyter notebook,进不进虚拟环境都可以。
参考博客,win+r打开cmd,进到虚拟环境中,直接依次运行:
conda install jupyter conda install ipykernel # 安装jupyter内核 # 添加虚拟环境到jupyter中 python -m ipykernel install --user --name study1 --display-name study1_py38 #如果需要移除jupyter中的虚拟环境,用这个命令 jupyter kernelspec remove 环境名
关闭jupyter,再次运行,出现自己的环境名称study1_py38,成功:
1.运行报错:ModuleNotFoundError: No module named 'keras'
但是我已经安装了keras。参考博客说是路径不对,打开Anaconda Prompt,运行下面的命令:
jupyter kernelspec list #查看当前的可用的kernel jupyter kernelspec remove study1 #删除前面创建的kernel activate study1 #进入虚拟环境 conda install ipykernel python -m ipykernel install --name study1 jupyter notebook #打开jupyter
2. 报错:ImportError: cannot import name 'bmat' from 'scipy.sparse.sputils' (D:anaconda3envsstudy1libsite-packagesscipysparsesputils.py)
参考博客,可能是版本太高的问题,先找到可以安装的版本。
conda search scipy #查看可以安装的scipy版本
降低一个版本,先降低版本到1.7.3
发现tensorflow的依赖需要scipy==1.4.1运行下面的命令将这些版本调整下:
pip install scipy==1.4.1 --user pip install gast==0.3.3 --user pip install numpy==1.19.0 --user pip install tensorflow-estimator==2.4.0 --user jupyter notebook #打开jupyter
运行成功
jupyter创建ipynb文件,重命名运行代码ctrl+enter



