Update pip3 for Python 3.6?

大兔子大兔子 提交于 2019-11-29 03:26:29

问题


I just upgraded from Python 3.4 to Python 3.6 using Homebrew.

The output states:

Pip, setuptools, and wheel have been installed. To update them
  pip3 install --upgrade pip setuptools wheel
You can install Python packages with
  pip3 install <package>
They will install into the site-package directory
  /usr/local/lib/python3.6/site-packages

I tried to run

pip3 install --upgrade pip setuptools wheel

But it does not upgrade pip for Python 3.6. Instead it finds pip3 in in Python 3.4 and says 'requirement satisfied':

Requirement already up-to-date: pip in /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages
Collecting setuptools
  Downloading setuptools-33.1.1-py2.py3-none-any.whl (472kB)
    100% |████████████████████████████████| 481kB 1.0MB/s 
Collecting wheel
  Downloading wheel-0.29.0-py2.py3-none-any.whl (66kB)
    100% |████████████████████████████████| 71kB 5.7MB/s 
Installing collected packages: setuptools, wheel
  Found existing installation: setuptools 12.0.5
    Uninstalling setuptools-12.0.5:
      Successfully uninstalled setuptools-12.0.5
Successfully installed setuptools-33.1.1 wheel-0.29.0

When I check the pip version, it is in Python 3.4, not 3.6. How do I resolve this?

$ pip3 -V
pip 9.0.1 from /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages (python 3.4)

回答1:


Not a good idea to install and try to use Python3.4 and 3.6 without virtualenv.

You can however tell the terminal on your mac which Python pip to use with:

python3.6 -m pip install --upgrade pip setuptools wheel

You can change python3.6 to python3.4 if you need to use pip on the older Python3 version.




回答2:


A temporary fix could be:

alias "pip3.6"="python3.6 -m pip $1"

This will allow you to go pip3.6 install somemodule or pip3.6 install --upgrade somemodule




回答3:


when I excute "python36 -m pip3 install -r requirements.txt", I met errors message

/usr/bin/python36: No module named pip3

my solution as following:

python3.6 -m ensurepip

python3.6 -m pip install -r requirements.txt

everything is OK now.



来源:https://stackoverflow.com/questions/41688016/update-pip3-for-python-3-6

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!