Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/347.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python pybedtools:ImportError:无法导入名称脚本_Python_Anaconda - Fatal编程技术网

Python pybedtools:ImportError:无法导入名称脚本

Python 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

我正在尝试在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/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