简体   繁体   English

ModuleNotFoundError: 没有名为“bcolz”的模块

[英]ModuleNotFoundError: No module named 'bcolz'

I'm working in the Jupyter Notebook inside a Conda environment.我正在 Conda 环境中的 Jupyter Notebook 中工作。
I've installed bcolz about three different ways but I always get the below screenshot on my notebook page.我已经bcolz三种不同的方式安装了bcolz ,但我总是在我的笔记本页面上看到下面的屏幕截图。
When I'm in the environment and type 'Python' or 'Python3' (in other words, go into Python) I can import the module with no problem when typing the same command being given to Jupyter import bcolz .当我在环境中输入“Python”或“Python3”(换句话说,进入 Python)时,我可以在输入与 Jupyter import bcolz相同的命令时毫无问题地import bcolz

Specifically, I installed by typing...具体来说,我通过键入安装...

conda install -c anaconda bcolz  
pip3 install bcolz  
conda install -c conda-forge bcolz  

and I think I also installed it within some other bundle of modules我想我也将它安装在其他一些模块包中
*I did a restart to the computer a few times as well. *我也重启了电脑几次。

UPDATE: I just took the import cbolz line out of the utils.py file the notebook was loading and put import cbolz into that cell instead.更新:我只是从笔记本加载的utils.py文件中取出import cbolz行,然后将import cbolz放入该单元格中。
Works now, didn't think of doing before.现在在用,以前没想过要做。 Am still interested in why it doesn't work in the first way.我仍然对为什么它不能以第一种方式工作感兴趣。

我的 Jupyter Notebook 错误截图

You are not running your jupyter notebook with the kernel associated with your conda environment.您没有使用与 conda 环境关联的内核运行 jupyter notebook。 Here is how to do it:这是如何做到的:

$ source activate my_conda_env
(my_conda_env) $ conda install nb_conda

Then, relaunch the jupyter notebook, and you will normally see my_conda_env in the kernel list.然后,重新启动 jupyter notebook,您通常my_conda_env在内核列表中看到my_conda_env Select it and run this in a cell in your notebook:选择它并在笔记本的单元格中运行它:

import bcolz

Just check if the module is even present in your system.只需检查该模块是否存在于您的系统中。

pip freeze | grep bcolz

or

conda list | grep bcolz

If both the commands return nil, you know you don't have this module installed.如果两个命令都返回 nil,则说明您没有安装此模块。 So, go ahead and install it by running所以,继续并通过运行安装它

conda install -c anaconda bcolz

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM