Biopython: ImportError: No module named TreeConstruction

Biopython: ImportError: No module named TreeConstruction

有人知道为什么我会收到以下错误吗?

>>> from Bio.Phylo.TreeConstruction import DistanceCalculator, DistanceTreeConstructor

Traceback (most recent call last):
  File "<pyshell#6>", line 1, in <module>
    import Bio.Phylo.TreeConstruction
ImportError: No module named TreeConstruction

还有:

>>> from Bio.Phylo.Consensus import *

Traceback (most recent call last):
  File "<pyshell#9>", line 1, in <module>
    from Bio.Phylo.Consensus import *
ImportError: No module named Consensus

感谢大家的宝贵时间=)

好的。已修复!

问题是在 python IDLE 中,biopython 的版本是 1.63,而代码

>>>from Bio.Phylo.TreeConstruction import DistanceCalculator, DistanceTreeConstructor

适用于 1.65 版。因此,解决方案是删除安装 biopython 1.63 的文件夹,然后下载并稍后(重新)安装 biopython 1.65.