python 2.7: no module named configparser

前端 未结 2 776
生来不讨喜
生来不讨喜 2021-01-12 07:05

I\'m trying to run db_create.py in Flask, and am getting the following error:

from six.moves.configparser import ConfigParser
ImportError: No mo         


        
相关标签:
2条回答
  • 2021-01-12 07:14

    For anyone following along, this was likely caused by an old (broken) version of the six module, e.g. see https://github.com/Parsely/streamparse/issues/113, for instance

    which caused six.moves to be almost empty (contained no configparser module)

    The fix was to upgrade the version of six used.

    0 讨论(0)
  • 2021-01-12 07:38

    I am using CENTOS RHEL 7 with Python 2.7.5 & pip version 8.1.2 and and fixed it doing:

    cd /home/user/
    sudo pip install configparser
    

    And it was done for me. But Previously i had installed:

    cd /home/user/
    pip install --user pytz requests tqdm tzlocal python-dateutil
    

    No problems at all.

    to know your python version and to know configparser check up:

    python --version
    
    python -c 'import six; print(six.__version__)'
    
    python -c 'import six.moves; print(dir(six.moves))'
    

    I had configparser installed previously but I was not working so I think you must install all the dependencies and libs of python pip on your /home/user_directory

    0 讨论(0)
提交回复
热议问题