install python collections

我怕爱的太早我们不能终老 提交于 2019-12-25 04:03:42

问题


i'm trying to install a program called qiime http://qiime.org/install/install.html and I have finished installing prerequisites and building and installing as per the instructions but I'm stuck because python cant find defaultdict Counter. I googled to install defaultdict but I found nothing. How do you install defaultdict and counter? This is the error I'm getting. Thanks

casey@casey-laptop:~/Downloads/Qiime-1.5.0/tests$ cd
casey@casey-laptop:~$ align_seqs.py -h
Traceback (most recent call last):
  File "/usr/local/bin/align_seqs.py", line 15, in <module>
    from qiime.util import parse_command_line_parameters, get_options_lookup
  File "/usr/local/lib/python2.6/dist-packages/qiime/util.py", line 25, in <module>
    from collections import defaultdict, Counter
ImportError: cannot import name Counter

casey@casey-laptop:~/Downloads/Qiime-1.5.0/tests$ python all_tests.py 
Traceback (most recent call last):
  File "all_tests.py", line 10, in <module>
    from qiime.util import (parse_command_line_parameters, get_options_lookup,
  File "/usr/local/lib/python2.6/dist-packages/qiime/util.py", line 25, in <module>
    from collections import defaultdict, Counter
ImportError: cannot import name Counter

回答1:


That qiime program seems to use the Counter class of the collections module. However that was introduced with Python 2.7 and you use Python 2.6.

So updating your Python to 2.7 (or installing 2.7 besides 2.6) is the solution.




回答2:


class collections.Counter is

New in version 2.7.



来源:https://stackoverflow.com/questions/10861076/install-python-collections

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!