更新Python 3.6的pip3?

问题描述 投票:8回答:3

我刚刚使用Homebrew从Python 3.4升级到Python 3.6。

输出状态:

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

我试着跑

pip3 install --upgrade pip setuptools wheel

但它不会升级Python 3.6的pip。相反,它在Python 3.4中找到pip3并说“满足要求”:

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

当我检查pip版本时,它是在Python 3.4中,而不是3.6。我该如何解决这个问题?

$ pip3 -V
pip 9.0.1 from /Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages (python 3.4)
python pip homebrew python-3.6
3个回答
7
投票

在没有virtualenv的情况下安装并尝试使用Python3.4和3.6并不是一个好主意。

但是,您可以告诉Mac上的终端使用哪个Python点:

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

如果需要在较旧的Python3版本上使用pip,可以将python3.6更改为python3.4。


2
投票

临时修复可能是:

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

这将允许你去pip3.6 install somemodulepip3.6 install --upgrade somemodule


0
投票

当我执行“python36 -m pip3 install -r requirements.txt”时,我遇到了错误消息

/ usr / bin / python36:没有名为pip3的模块

我的解决方案如下:

python3.6 -m ensurepip

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

现在一切都好。

© www.soinside.com 2019 - 2024. All rights reserved.