python - “模块”没有属性 'Treestyle'

标签 python pyqt4 ete3

如果在 stackoverflow 上发现一些点击,其中人们在未安装 PyQT4 时使用 ete3 工具时遇到问题,这(过去)也适用于我。然而,我现在尝试重新安装一个软件,它一直提示“模块”没有属性“Treestyle”。

为了测试 PyQT 是否已安装,我运行了这个 python 脚本:

from PyQt4.Qt import PYQT_VERSION_STR
print("PyQt version:", PYQT_VERSION_STR)

打印内容:

('PyQt version:', '4.12.1')

我收到这个(常见)错误:

Traceback (most recent call last):
  File "/mnt/f/mypy/bin/virtualmicrobes.py", line 1820, in <module>
    sys.exit(main())
  File "/mnt/f/mypy/bin/virtualmicrobes.py", line 1793, in main
    args.start(args)
  File "/mnt/f/mypy/bin/virtualmicrobes.py", line 408, in start_evo_sim
    result = init_and_simulate(simu, intermediate_load_file, _options)
  File "/mnt/f/mypy/local/lib/python2.7/site-packages/VirtualMicrobes/my_tools/utility.py", line 117, in wrapper
    raise ex_type(message)
AttributeError: 'module' object has no attribute 'TreeStyle' (in subprocess)
  File "/mnt/f/mypy/local/lib/python2.7/site-packages/VirtualMicrobes/my_tools/utility.py", line 91, in process_func
    ret = func(*args, **kwargs)
  File "/mnt/f/mypy/bin/virtualmicrobes.py", line 295, in init_and_simulate
    sim = sim_mod.create_simulation(**options)
  File "/mnt/f/mypy/local/lib/python2.7/site-packages/VirtualMicrobes/simulation/Simulation.py", line 1940, in create_simulation
    sim = ODE_simulation(params_dict)
  File "/mnt/f/mypy/local/lib/python2.7/site-packages/VirtualMicrobes/simulation/Simulation.py", line 1342, in __init__
    super(ODE_simulation, self).__init__(params)
  File "/mnt/f/mypy/local/lib/python2.7/site-packages/VirtualMicrobes/simulation/Simulation.py", line 86, in __init__
    self.init_graphs()
  File "/mnt/f/mypy/local/lib/python2.7/site-packages/VirtualMicrobes/simulation/Simulation.py", line 795, in init_graphs
    show=show, clean=clean, create=create)
  File "/mnt/f/mypy/local/lib/python2.7/site-packages/VirtualMicrobes/plotting/Graphs.py", line 1188, in __init__
    self.init_phylo_tree_graph(clean=clean)
  File "/mnt/f/mypy/local/lib/python2.7/site-packages/VirtualMicrobes/plotting/Graphs.py", line 1219, in init_phylo_tree_graph
    show=show, attribute_dict=self.attribute_mapper, create=clean, **kwargs)
  File "/mnt/f/mypy/local/lib/python2.7/site-packages/VirtualMicrobes/plotting/Graphs.py", line 985, in __init__
    self.init_tree_style_dict() # NOTE: unordered ok
  File "/mnt/f/mypy/local/lib/python2.7/site-packages/VirtualMicrobes/plotting/Graphs.py", line 1110, in init_tree_style_dict
    branch_vertical_margin=branch_vertical_margin)
  File "/mnt/f/mypy/local/lib/python2.7/site-packages/VirtualMicrobes/plotting/Graphs.py", line 1083, in make_tree_style
    ts = ete3.TreeStyle() 

注意:这一次我尝试将其安装在 Ubuntu for Windows 上,但到目前为止,几乎所有在 Linux 上运行的东西也都在这个上运行。但它可能是相关的。

有什么想法吗?

PS 要重现该问题,请按照以下步骤操作:

$ sudo apt-get install python-qt4
$ virtualenv ~/mypy --system-site-packages
$ source ~/mypy/bin/activate 
$ (mypy) > pip install VirtualMicrobes
$ (mypy) > virtualmicrobes evo --name TestMicrobes >> error

PPS 用户 eyllanesc 确认这是“Ubuntu for Windows”问题。不过,我仍在尝试修复它,如果有人可以帮助我弄清楚如何将 pyqt4 包正确链接到我的 virtualenv,那就太好了。我已经尝试使用 ln -s 链接 native 链接,但我没有得到任何进一步

最佳答案

我也遇到过类似的问题。问题可能是您没有安装所有依赖项,而 ete3 没有告诉您所有依赖项。

您可以查看此代码缺少哪些依赖项:

import ete3
ete3.__file__

运行它,它会告诉您缺少哪些依赖项。请注意,在安装全部之前,您可能需要运行它多次!

关于python - “模块”没有属性 'Treestyle',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52864805/

相关文章:

python - 如何忽略已经存在的文件?

python - 如何使用状态为 Keras fit_generator 编写生成器?

pyqt - PyQt4 使用什么尺寸单位?

python - QGraphicsView.fitInView() 未按预期工作

python - 如何删除 QTreeWidgetItem 的 child

python-3.x - 在 ete3 中为热图添加标签

algorithm - 有没有什么方法可以简单地将二叉搜索树可视化?

python - 如何使文件中的每一行成为包含整个文件的列表的子列表?

python - 如何将颜色条刻度标签更改为百分比

python - 如何从 NetworkX 图转换为 ete3 Tree 对象?