[Python] The error occurred when I tried to run a file using a pypi library for the second time

Discussão em 'Python' iniciado por Stack, Julho 14, 2025.

  1. Stack

    Stack Membro Participativo

    I used pip install to download colorgram.py library on vscode once and it was successful and usable. The next time I tried to run that file again and error occurred

    `
    PS D:\baitap> pip install colorgram.py Traceback (most recent call last):
    File "<frozen runpy>", line 198, in _run_module_as_main
    File "<frozen runpy>", line 88, in _run_code
    File "D:\Scripts\pip.exe\___main__.py", line 4, in <module> from pip._internal.cli.main import main ModuleNotFoundError: No module named 'pip'
    `


    And I tried to fix it by python -m ensurepip --user

    But then I deleted it and tried to reinstall the colorgram module again but it was not saved in the site-pakages in .venv but saved in the external site-pakages. I tried to copy and paste it back into the site-pakages of .venv but it still failed.

    `PS D:\baitap> python -u "d:\baitap\quiz-game-start\hirstPainting.py"
    d:\baitap\quiz-game-start\hirstPainting.py:5: SyntaxWarning: invalid escape sequence '\s'
    colors = colorgram.extract("quiz-game-start\spot.jpg", 88)
    Traceback (most recent call last):
    File "d:\baitap\quiz-game-start\hirstPainting.py", line 3, in <module>
    import colorgram
    ModuleNotFoundError: No module named 'colorgram'`


    can someone help me fix this problem please . Or is this simply a vscode bug???

    Continue reading...

Compartilhe esta Página