sys.executable结果在终端和jupyter笔记本中有所不同 [英] sys.executable results are different in terminal and jupyter notebook

查看:112
本文介绍了sys.executable结果在终端和jupyter笔记本中有所不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因为我遇到了一个问题:在Jupyter笔记本中使用from imageio import imread时,出现错误:ModuleNotFoundError: No module named 'imageio' 尽管我可以在终端中成功导入,但是我尝试弄清楚发生了什么. 当我在Jupyter Notebook和终端中执行sys.executable时,结果是不同的:

Because I face a problem: When from imageio import imread in my jupyter notebook, I get the error: ModuleNotFoundError: No module named 'imageio' Whereas I can successfully import in my terminal, I try to figure out what happened. When I execute sys.executable in jupyter notebook and in the terminal, the results are different:

所以我尝试了:(来自 https://github.com/jupyter /notebook/issues/1524#issuecomment-229713719 )

So I tried:(from https://github.com/jupyter/notebook/issues/1524#issuecomment-229713719)

/Users/shinyuwu/anaconda3/bin/python -m pip install ipykernel
/Users/shinyuwu/anaconda3/bin/python -m  ipykernel install

但是jupyter笔记本和终端中的sys.executable结果仍然不同.谁能帮我吗?

But the sys.executable result in jupyter notebook and terminal are still different. Can anyone help me?

推荐答案

一段时间以后我就遇到了这个问题

I had faced this issue some time back

我解决这个问题的方式是

The way I solved this was

  1. 从系统中删除IPython和Jupyter

  1. Deleting IPython and Jupyter from the system

rm -rf ~/.local/share/ipython

重新安装IPython和Jupyter

Reinstall IPython and Jupyter

这篇关于sys.executable结果在终端和jupyter笔记本中有所不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆