1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Python] Python 3.x ImportError: No module named configparser , but module is installed

Discussão em 'Python' iniciado por Stack, Outubro 4, 2024 às 21:42.

  1. Stack

    Stack Membro Participativo

    In my code i am using configparser. Everything working fine, but after i do fresh install of windows 10, this error appears: ImportError: No module named configparser.

    • But same code working on other pc
    • Python is in PATH (double checked)
    • Try reinstall python
    • configparser is installed by default, but still try "pip install configparser"

    I am using Python 3.7.1 In same code i do "import os" and this is working. Configparser is in same directory.

    EDIT:

    configparser is here:

    c:\Program Files\Python37\Lib\configparser.py


    after pip install configparser, there is another:

    c:\Program Files\Python37\Lib\site-packages\backports\configparser\__init__.py


    EDIT_2:

    Try copy:

    c:\Program Files\Python37\Lib\configparser.py


    to my working folder. Result:

    Traceback (most recent call last):
    File "C:\git\silixcon_lib\production_data.py", line 4, in <module>
    import configparser
    File "C:\git\silixcon_lib\configparser.py", line 434
    option, section, rawval, var) from None
    ^
    SyntaxError: invalid syntax


    This is working:

    Copy this to my working folder:

    c:\Program Files\Python37\Lib\site-packages\backports\configparser\__init__.py


    and rename it to configparser.py. At lines 138-140 change "backports.configparser.helpers" to "helpers"

    and this copy too:

    c:\Program Files\Python37\Lib\site-packages\backports\configparser\helpers.py

    Continue reading...

Compartilhe esta Página