ImportError: No module named pip

前端 未结 19 685
时光取名叫无心
时光取名叫无心 2020-12-04 06:56

OS: Mac OS X 10.7.5 Python Ver: 2.7.5

I have installed setuptools 1.0 with ez_setup.py from https://pypi.python.org/pypi/setuptools Then I download pip.1.4.1 pkg fr

相关标签:
19条回答
  • 2020-12-04 07:31

    On Mac using brew is a better option as apt-get is not available. Command:

    brew install python
    

    In case you have both python2 & python3 installed on machine

    python2.7 -m ensurepip --default-pip
    

    simply should solve the issue.

    If instead you are missing pip from python 3 then simply change python2.7 to python3 in the command above.

    0 讨论(0)
  • 2020-12-04 07:37

    I ran into this same issue when I attempted to install the nova client.

    spencers-macbook-pro:python-novaclient root# python  setup.py install    
    running install
    /usr/bin/python: No module named pip
    error: /usr/bin/python -m pip.__init__ install   'pbr>=0.5.21,<1.0' 'iso8601>=0.1.4' 'PrettyTable>=0.6,<0.8' 'requests>=1.1' 'simplejson>=2.0.9' 'six' 'Babel>=0.9.6' returned 1
    

    I use homebrew so I worked around the issue with sudo easy_install pip

    spencers-macbook-pro:python-novaclient root# brew search pip
    aespipe     brew-pip    lesspipe    pipebench   pipemeter   spiped  pipeviewer
    
    If you meant "pip" precisely:
    
    Homebrew provides pip via: `brew install python`. However you will then
    have two Pythons installed on your Mac, so alternatively you can:
        sudo easy_install pip
    spencers-macbook-pro:python-novaclient root# sudo easy_install pip
    

    The commands should be similar if you use macports.

    0 讨论(0)
  • 2020-12-04 07:37

    In terminal try this:

    ls -lA /usr/local/bin | grep pip
    

    in my case i get:

    -rwxr-xr-x 1 root  root      284 Сен 13 16:20 pip
    -rwxr-xr-x 1 root  root      204 Окт 27 16:37 pip2
    -rwxr-xr-x 1 root  root      204 Окт 27 16:37 pip2.7
    -rwxr-xr-x 1 root  root      292 Сен 13 16:20 pip-3.4
    

    So pip2 || pip2.7 in my case works, and pip

    0 讨论(0)
  • 2020-12-04 07:39

    Try to install pip through Python:

    Please go to: https://pip.pypa.io/en/stable/installing/

    and download get-pip.py, and then run:

    (sudo) python get-pip.py
    
    0 讨论(0)
  • 2020-12-04 07:40

    Here's a minimal set of instructions for upgrading to Python 3 using MacPorts:

    sudo port install py37-pip
    sudo port select --set pip pip37
    sudo port select --set pip3 pip37
    sudo pip install numpy, scipy, matplotlib
    

    I ran some old code and it works again after this upgrade.

    0 讨论(0)
  • 2020-12-04 07:42

    Run

    curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
    

    Then run the following command in the folder where you downloaded: get-pip.py

    python get-pip.py
    
    0 讨论(0)
提交回复
热议问题