今天的这个报错比较有意思,在anaconda环境下,
ModuleNotFoundError: No module named 'IPython'
赶紧测试了一下,发现ipython已经安装且一点问题都没有,
(torch) PS D:\vsai\evaluate> ipython
Python 3.8.8 (default, Apr 13 2021, 15:08:03) [MSC v.1916 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 7.22.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: ?
IPython -- An enhanced Interactive Python
=========================================
IPython offers a fully compatible replacement for the standard Python
interpreter, with convenient shell features, special commands, command
history mechanism and output results caching.
At your system command line, type 'ipython -h' to see the command line
options available. This document only describes interactive features.
GETTING HELP
------------
Within IPython you have various way to access help:
? -> Introduction and overview of IPython's features (this screen).
object? -> Details about 'object'.
object?? -> More detailed, verbose information about 'object'.
%quickref -> Quick reference of all IPython specific syntax and magics.
help -> Access Python's own help system.
If you are in terminal IPython you can quit this screen by pressing `q`.
MAIN FEATURES
-------------
* Access to the standard Python help with object docstrings and the Python
manuals. Simply type 'help' (no quotes) to invoke it.
* Magic commands: type %magic for information on the magic subsystem.
* System command aliases, via the %alias command or the configuration file(s).
* Dynamic object information:
Typing ?word or word? prints detailed information about an object. Certain
long strings (code, etc.) get snipped in the center for brevity.
Typing ??word or word?? gives access to the full information without
In [2]: quit
(torch) PS D:\vsai\evaluate> python
那么,为什么会找不到ipython呢?决定再试,
(torch) PS D:\vsai\evaluate> python
Python 3.9.7 (default, Sep 16 2021, 16:59:28) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import IPython
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'IPython'
>>> exit()
(torch) PS D:\vsai\evaluate>
从这里可以看出,anaconda在通用命令行环境时可以找到ipython,但是,在创建的torch环境下找不到ipython,因此import IPython无法成功,因此,再安装一下就可以了,如下
(torch) PS D:\vsai\evaluate> conda install -c anaconda ipython
。。。。。。
通用anaconda安装,当然也可以用pip安装,不过我这里已经OK了,就不再试了。
然后,在python中再测试,就有了,嗯,我自己还加了一句测试打印代码。
(torch) PS D:\vsai\evaluate> python
Python 3.9.7 (default, Sep 16 2021, 16:59:28) [MSC v.1916 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import IPython
---------------------subprocess.checkout--------------------
>>> exit()
(torch) PS D:\vsai\evaluate>
与nbviewer不同, nbviewer每个代码单元均根据请求执行。
输入变量可以在执行之前注入到笔记本中。
运行app.py启动flask站点,该站点将呈现markdown和更新的代码输出单元格。
使用常规模板方法在现有烧瓶位置内渲染笔记本。
可以通过启动notebooks目录中的IPython Notebook服务器来开发页面。
动态执行和渲染使用Widget进行交互式页面的笔记本。
欢迎提出更好的方法,反馈和提出要求的想法!
报错:ImportError: No module named IPython
检查是否安装:ipython --version
提示:The program 'ipython' is currently not installed. You can install it by typing: sudo apt install ipython
按照提示安...
解决 ModuleNotFoundError: No module named ‘ipykernel’
使用pycharm的时候,遇到ModuleNotFoundError: No module named 'ipykernel’的问题。在这里分享一下自己的处理方法。
打开pycharm,找到Interpreter Settings,点击之后,进入Project Interpreter。
进入 Project Interpreter之后,点击 + 号。
在弹窗中,搜索ipyke
File "<stdin>", line 1, in <module> ModuleNotFoundError: No module named 'model'
当我们导入一个模块时:import xxx 或者 from xx import xxx,...
"ModuleNotFoundError: No module named 'xxx'"这个报错是个非常常见的报错,几乎每个python程序员都遇到过,导致这个报错的原因也非常多,下面是我曾经遇到过的原因和解决方案
module包没安装
忘了import
没有__init__.py文件
package包的版本不对
自定义的包名与安装的包名相同,导致import包的时候导错了包
没设置PYTHO...
不久前在实验使用https://github.com/StanfordVL/rubiksnet这个视频动作识别模型时,发现其对python版要求3.7以上,于是尝鲜下载了个python3.9.6编译安装:
wget https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tgz
tar xf Python-3.9.6.tgz
cd Python-3.9.6
sudo apt-get install build-essential python3-dev
#原则相冲突,请谅解,勿喷
ModuleNotFoundError: No module named ‘xxx’ 分析
这个问题只要是用过python的人,一般或多或少都会遇到过这个问题,这个问题其实很明确,就是你import的module找不到。
关于为啥找不到的原因,倒是有很多花里胡哨原因。
Python module的搜索路径
python的module搜索路径,其实是编译python的时候就有相关的