File “/usr/bin/pip”, line 9, in from pip import main ImportError: cannot import name main

后端 未结 6 466
轻奢々
轻奢々 2020-12-07 17:58

I am trying to run a webpage using python flask and connecting it with the database of MySQL and while installing MySQL packages I\'m receiving this error.

6条回答
  •  被撕碎了的回忆
    2020-12-07 18:17

    These steps worked for me.

    1- Uninstall the pip update from python.
    2- Uninstall pip package from your Ubuntu.
    3- Check that pip binary is not longer in your system.

    python -m pip uninstall pip
    apt remove python-pip
    whereis pip
    

    4- Download and install pip. (credits for VanDragt.com)

    wget https://bootstrap.pypa.io/get-pip.py -O /tmp/get-pip.py
    sudo python3 /tmp/get-pip.py
    pip install --user pipenv
    pip3 install --user pipenv
    echo "PATH=$HOME/.local/bin:$PATH" >> ~/.profile
    source ~/.profile
    whereis pip
    

    Now you should be able to install any pip package you want.

提交回复
热议问题