Python pybedtools:ImportError:无法导入名称脚本
我正在尝试在Spyder中导入PybedtoolsPython pybedtools:ImportError:无法导入名称脚本,python,anaconda,Python,Anaconda,我正在尝试在Spyder中导入Pybedtools from pybedtools import BedTool 这就是我得到的错误: Traceback (most recent call last): File "<ipython-input-13-7a8ea5d1dea8>", line 1, in <module> from pybedtools import BedTool File "/Users/michaelsmith/anaconda2/li
from pybedtools import BedTool
这就是我得到的错误:
Traceback (most recent call last):
File "<ipython-input-13-7a8ea5d1dea8>", line 1, in <module>
from pybedtools import BedTool
File "/Users/michaelsmith/anaconda2/lib/python2.7/site-packages/pybedtools/__init__.py", line 9, in <module>
from . import scripts
ImportError: cannot import name scripts
并将文件夹的名称也更改为scripts2
。但是,我仍然得到这样的错误:
ImportError: cannot import name scripts2
所以我一定是做错了什么,我应该准确地重命名哪个模块?如果这是一个愚蠢的问题,很抱歉,我对python还很陌生 这是因为Anaconda有一个名为
scripts
的模块,因此您的导入被该模块“隐藏”。在新笔记本中调用import scripts
时,即使您从未定义过这样的模块,也可以再次检查它是否有效。关于导入陷阱的一个很好的解释可以在这里找到:
解决方法是将
pybedtools
的script
模块重命名为其他模块,并将所有导入更改为新名称。谢谢!因此,我将pybedtools
的scripts
文件夹重命名为scripts2
,仍然收到导入错误。也许我误解了您的建议?我想您还需要查看使用import scripts
的代码,并将其更改为import scripts2
ImportError: cannot import name scripts2