Module installed on Conda, but gives error on importing in Spyder (Python IDE)(模块安装在 Conda 上,但在 Spyder (Python IDE) 中导入时出错)
问题描述
我最近在我的 Conda 中安装了 pybedtools环境,使用他们提到的命令 -
I recently installed pybedtools in my Conda environment, using the command they mentioned -
conda install -c bioconda pybedtools
但是当我在这个环境中激活 spyder 并尝试运行 import pybedtools 它给了我错误-
But then when I activated spyder in this environment, and tried to run import pybedtools it gave me the error-
Modulenotfounderror: no module named 'pybedtools'
我回去尝试使用 pip 的模块进行安装(pip install pybedtools)但它说我已经有了它 -
I went back and tried to install using the module using pip too (pip install pybedtools) but it said that I already had it -
要求已经满足:/anaconda3/envs/env1/lib/python3.5/site-packages 中的 pybedtools已满足要求:./anaconda3/envs/env1/lib/python3.5/site-packages 中的六个(来自 pybedtools)
所以,我无法理解模块是如何安装的,但 Spyder 不允许我导入它.我以前从未遇到过 Anaconda 的这个问题.任何帮助都会很棒!
So, I am unable to understand how it is that the module is installed yet Spyder does not allow me to import it. I have never faced this issue with Anaconda before. Any help would be great!
推荐答案
这是我解决问题的方法 -
Here is how I was able to solve the issue -
- 激活
root环境.这可以通过 Windows 中的activate root和 Ubuntu/Mac 中的source activate root来完成 - 在此处安装上述软件包.这可以使用您在以前的环境中安装软件包时使用的相同命令来完成
- 回到原来的环境.现在问题将得到解决.
- activate the
rootenvironment. This can be done byactivate rootin Windows andsource activate rootin Ubuntu/Mac - install the said package here. This can be done using the same command that you used to install the package in your previous environment
- Go back to your original environment. The problem will now be resolved.
不过,我很想知道为什么这种方法有效!
I would love to know, though, why this method works!
这篇关于模块安装在 Conda 上,但在 Spyder (Python IDE) 中导入时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:模块安装在 Conda 上,但在 Spyder (Python IDE) 中导入
基础教程推荐
- kivy 应用程序中的一个简单网页作为小部件 2022-01-01
- Python,确定字符串是否应转换为 Int 或 Float 2022-01-01
- Python 中是否有任何支持将长字符串转储为块文字或折叠块的 yaml 库? 2022-01-01
- Kivy 使用 opencv.调整图像大小 2022-01-01
- matplotlib 设置 yaxis 标签大小 2022-01-01
- 比较两个文本文件以找出差异并将它们输出到新的文本文件 2022-01-01
- 对多索引数据帧的列进行排序 2022-01-01
- 究竟什么是“容器"?在蟒蛇?(以及所有的 python 容器类型是什么?) 2022-01-01
- 在 Django Admin 中使用内联 OneToOneField 2022-01-01
- 在 Python 中将货币解析为数字 2022-01-01
