如何解决jupyternotebook无法导入自己安装的包,
如何解决jupyternotebook无法导入自己安装的包,
目录
- 问题描述
- 解决办法
- 总结
问题描述
在使用jupyter notebook跑代码时,明明在虚拟环境(虚拟环境名字就是pytorch)中安装了pytorch,但是在导包的时候却报错,找不到对应的安装包
jupyter notebook中输入运行如下代码,看看虚拟环境中的python库目录,发现里边根本没有包含我的虚拟环境所在路径
(我的虚拟环境路径是:C:\others\my_software\anaconda\envs\pytorch\Lib\site-packages
)。
import sys sys.path
解决办法
添加环境变量PYTHONPATH
和site-packages
安装包的路径
再次查看虚拟环境中的python库目录,发现里包含我的虚拟环境所在路径
(我的虚拟环境路径是:C:\others\my_software\anaconda\envs\pytorch\Lib\site-packages
)。
import sys sys.path
此时就可以正常导包了
总结
以上为个人经验,希望能给大家一个参考,也希望大家多多支持3672js教程。
您可能感兴趣的文章:- Jupyter Notebook 安装配置与使用详解
- Jupyter Notebook安装及使用方法解析
- Python学习工具jupyter notebook安装及用法解析
- Python安装Jupyter Notebook配置使用教程详解
- Pycharm安装并配置jupyter notebook的实现
- jupyter notebook的安装与使用详解
评论关闭