最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】Mac中把Python3的pip重新换成Python2的pip

Mac crifan 10547浏览 0评论

折腾:

【已解决】Mac本地用supervisor去管理gunicorn的Python3的Flask

期间发现:不知道何时,Mac默认的pip,竟然变成python3的了。

需要重新把Mac本地的实际上是pip3的pip去重新安装回来python2的pip

-》否则后续系统使用pip,也会出现问题的。

感觉像是:

【已解决】Mac本地安装Python3的pipenv虚拟环境

中的:

<code>python3 -m pip install --upgrade --force-reinstall pip
</code>

而把原本是python2的pip,强制安装成python3的pip了?

参考之前的去看看:

<code>➜  robotDemo ll /usr/local/bin/pip*
-rwxr-xr-x  1 crifan  admin   235B  4 17 11:05 /usr/local/bin/pip
-rwxr-xr-x  1 crifan  admin   235B  4 17 10:18 /usr/local/bin/pip2
-rwxr-xr-x  1 crifan  admin   235B  4 17 10:18 /usr/local/bin/pip2.7
lrwxr-xr-x  1 crifan  admin    33B  4 17 10:52 /usr/local/bin/pip3 -&gt; ../Cellar/python/3.6.4_4/bin/pip3
lrwxr-xr-x  1 crifan  admin    35B  4 17 10:52 /usr/local/bin/pip3.6 -&gt; ../Cellar/python/3.6.4_4/bin/pip3.6
</code>

貌似好似存在pip的啊

但是为何:

<code>➜  robotDemo which pip
pip: aliased to noglob pip
</code>

?

其他的好像都正常:

<code>➜  robotDemo which pip2
/usr/local/bin/pip2
➜  robotDemo which pip3
/usr/local/bin/pip3
➜  robotDemo which python2
python2 not found
➜  robotDemo which python
/usr/bin/python
➜  robotDemo python --version
Python 2.7.10
➜  robotDemo which python3
/usr/local/bin/python3
➜  robotDemo python3 --version
Python 3.6.4
</code>

mac python3 pip change to python2

python – How to override the pip command to Python3.x instead of Python2.7? – Stack Overflow

好像就是用对应的版本(Python2 or Python3)强制重新安装就可以了?

去试试

<code>python2 -m pip install --upgrade --force-reinstall pip
</code>

结果:

<code>➜  robotDemo python2 -m pip install --upgrade --force-reinstall pip
zsh: command not found: python2
</code>

换成:

<code>python -m pip install --upgrade --force-reinstall pip
</code>

结果:

<code>➜  robotDemo python -m pip install --upgrade --force-reinstall pip
/usr/bin/python: No module named pip
</code>

换成:

<code>python --upgrade --force-reinstall pip
</code>

好像不太对。

pip command is mixed up in python2 and python3 · Issue #50607 · Homebrew/legacy-homebrew

也是说:

<code>python3 -m pip install -U --force-reinstall pip
python -m pip install -U --force-reinstall pip
</code>

需要先去解决:

python -m pip install No module named pip

python – ImportError: No module named pip when trying to install packages – Stack Overflow

python – Pip is not working: ImportError: No module named ‘pip._internal’ – Ask Ubuntu

算了去试试:

<code>➜  robotDemo brew install pip
Error: No available formula with the name "pip"
Homebrew provides pip via: `brew install python`. However you will then
have two Pythons installed on your Mac, so alternatively you can install
pip via the instructions at:
https://pip.readthedocs.io/en/stable/installing/
➜  robotDemo brew install python-pip
Error: No available formula with the name "python-pip"
==&gt; Searching for a previously deleted formula (in the last month)...
Warning: homebrew/core is shallow clone. To get complete history run:
  git -C "$(brew --repo homebrew/core)" fetch --unshallow

Error: No previously deleted formula found.
==&gt; Searching for similarly named formulae...
==&gt; Searching local taps...
Error: No similarly named formulae found.
==&gt; Searching taps...
==&gt; Searching taps on GitHub...
Error: No formulae found in taps.
</code>

去搜:

pip: aliased to noglob pip

alias – bypass ‘noglob’ for ‘which’ in zsh? – Super User

oh my zsh – zsh command cannot found pip – Stack Overflow

mac change pip3 to pip

How to change pip3 command to be pip? – Stack Overflow

QuickTip: How Do I Install pip on macOS or OS X?

再去看看:

<code>➜  robotDemo where pip
pip: aliased to noglob pip
/usr/local/bin/pip
➜  robotDemo which pip
pip: aliased to noglob pip

➜  robotDemo ls -lh /usr/local/bin/pip*
-rwxr-xr-x  1 crifan  admin   235B  4 17 11:05 /usr/local/bin/pip
-rwxr-xr-x  1 crifan  admin   235B  4 17 10:18 /usr/local/bin/pip2
-rwxr-xr-x  1 crifan  admin   235B  4 17 10:18 /usr/local/bin/pip2.7
lrwxr-xr-x  1 crifan  admin    33B  4 17 10:52 /usr/local/bin/pip3 -&gt; ../Cellar/python/3.6.4_4/bin/pip3
lrwxr-xr-x  1 crifan  admin    35B  4 17 10:52 /usr/local/bin/pip3.6 -&gt; ../Cellar/python/3.6.4_4/bin/pip3.6
➜  robotDemo /usr/local/bin/pip --version
pip 10.0.0 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)
➜  robotDemo /usr/local/bin/pip2 --version
zsh: /usr/local/bin/pip2: bad interpreter: /usr/local/opt/python/bin/python2.7: no such file or directory
➜  robotDemo /usr/local/bin/pip2.7 --version
zsh: /usr/local/bin/pip2.7: bad interpreter: /usr/local/opt/python/bin/python2.7: no such file or directory
➜  robotDemo /usr/local/bin/pip3 --version
pip 10.0.0 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)
</code>

看来是:

此处的python2的pip就有问题了。

mac python 重装 pip

mac python install pip

如何在mac版本的python里安装pip? – 知乎

python – How do I install pip on macOS or OS X? – Stack Overflow

都说:

sudo easy_install pip

所以算了,还是先去解决:

【未解决】Mac中Python2的easy_install的问题:ImportError cannot import name ContextualZipFile

pip – Python 包和依赖关系管理 – Python开发 – 评论 | CTOLib码库

试试:

<code>pythonget-pip.py --user
</code>

是可以的:

<code>➜  robotDemo python get-pip.py --user
Collecting pip
  Using cached https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl
Collecting wheel
  Using cached https://files.pythonhosted.org/packages/1b/d2/22cde5ea9af055f81814f9f2545f5ed8a053eb749c08d186b369959189a8/wheel-0.31.0-py2.py3-none-any.whl
pipenv 11.10.0 requires certifi, which is not installed.
pipenv 11.10.0 requires requests[security], which is not installed.
pipenv 11.10.0 requires virtualenv, which is not installed.
matplotlib 1.3.1 requires nose, which is not installed.
matplotlib 1.3.1 requires tornado, which is not installed.
Installing collected packages: pip, wheel
  The script wheel is installed in '/Users/crifan/Library/Python/2.7/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-10.0.1 wheel-0.31.0
</code>

但是明显提示了:

/Users/crifan/Library/Python/2.7/bin

没有在PATH中

但是又不能直接放到PATH中,否则就和之前安装的python3的pipenv冲突了:

<code>➜  robotDemo ll /Users/crifan/Library/Python/3.6/bin
total 40
-rwxr-xr-x  1 crifan  staff   242B  4 17 14:35 pewtwo
-rwxr-xr-x  1 crifan  staff   226B  4 17 14:35 pipenv
-rwxr-xr-x  1 crifan  staff   237B  4 17 14:35 pipenv-resolver
-rwxr-xr-x  1 crifan  staff   232B  4 17 11:06 virtualenv
-rwxr-xr-x  1 crifan  staff   237B  4 17 11:06 virtualenv-clone
</code>

然后看看此处的:

<code>➜  robotDemo pip --version
pip 10.0.1 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)
➜  robotDemo which pip
pip: aliased to noglob pip
➜  robotDemo ls -hl /Users/crifan/Library/Python/2.7/bin
total 80
-rwxr-xr-x  1 crifan  staff   253B  4 17 10:19 easy_install
-rwxr-xr-x  1 crifan  staff   253B  4 17 10:19 easy_install-2.7
-rwxr-xr-x  1 crifan  staff   242B  4 17 10:19 pewtwo
-rwxr-xr-x  1 crifan  staff   215B  4 20 15:26 pip
-rwxr-xr-x  1 crifan  staff   215B  4 20 15:26 pip2
-rwxr-xr-x  1 crifan  staff   215B  4 20 15:26 pip2.7
-rwxr-xr-x  1 crifan  staff   226B  4 17 10:19 pipenv
-rwxr-xr-x  1 crifan  staff   237B  4 17 10:19 pipenv-resolver
-rwxr-xr-x  1 crifan  staff   237B  4 17 10:19 virtualenv-clone
-rwxr-xr-x  1 crifan  staff   212B  4 20 15:26 wheel
➜  robotDemo /Users/crifan/Library/Python/2.7/bin/pip --version
pip 10.0.1 from /Users/crifan/Library/Python/2.7/lib/python/site-packages/pip (python 2.7)
➜  robotDemo /Users/crifan/Library/Python/2.7/bin/pipenv --version
zsh: /Users/crifan/Library/Python/2.7/bin/pipenv: bad interpreter: /usr/local/opt/python/bin/python2.7: no such file or directory
➜  robotDemo /Users/crifan/Library/Python/2.7/bin/easy_install --version
zsh: /Users/crifan/Library/Python/2.7/bin/easy_install: bad interpreter: /usr/local/opt/python/bin/python2.7: no such file or directory
➜  robotDemo /Users/crifan/Library/Python/2.7/bin/pewtwo --version
zsh: /Users/crifan/Library/Python/2.7/bin/pewtwo: bad interpreter: /usr/local/opt/python/bin/python2.7: no such file or directory
➜  robotDemo /Users/crifan/Library/Python/2.7/bin/pip2.7 --version
pip 10.0.1 from /Users/crifan/Library/Python/2.7/lib/python/site-packages/pip (python 2.7)
➜  robotDemo /Users/crifan/Library/Python/2.7/bin/pipenv-resolver --version
zsh: /Users/crifan/Library/Python/2.7/bin/pipenv-resolver: bad interpreter: /usr/local/opt/python/bin/python2.7: no such file or directory
➜  robotDemo cat /Users/crifan/Library/Python/2.7/bin/pipenv
#!/usr/local/opt/python/bin/python2.7

# -*- coding: utf-8 -*-
import re
import sys

from pipenv import cli

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
    sys.exit(cli())
➜  robotDemo ll /usr/local/opt/python/bin/py
pydoc3@             python3@            python3.6@          python3.6m@         pyvenv@
pydoc3.6@           python3-config@     python3.6-config@   python3.6m-config@  pyvenv-3.6@
</code>

很明显,此处之前安装了python2的pipenv,使得:

/Users/crifan/Library/Python/2.7/bin

中有了:

pewtwo

pipenv

pipenv-resolver

virtualenv-clone

但是之前去删除掉python2的pipenv后,是把pipenv从:

/usr/local/opt/python/bin/

去掉了,但是却没有去掉:

/Users/crifan/Library/Python/2.7/bin

残留的那些文件

-》

所以感觉,可以放心的删除掉:

/Users/crifan/Library/Python/2.7/bin

之前残留的和pipenv相关的几个文件了。

但是删除之前,去看看此处的:

/Users/crifan/Library/Python/3.6/bin

中有哪些pipenv相关的文件

<code>➜  robotDemo ls -hl /Users/crifan/Library/Python/3.6/bin
total 40
-rwxr-xr-x  1 crifan  staff   242B  4 17 14:35 pewtwo
-rwxr-xr-x  1 crifan  staff   226B  4 17 14:35 pipenv
-rwxr-xr-x  1 crifan  staff   237B  4 17 14:35 pipenv-resolver
-rwxr-xr-x  1 crifan  staff   232B  4 17 11:06 virtualenv
-rwxr-xr-x  1 crifan  staff   237B  4 17 11:06 virtualenv-clone
➜  robotDemo ls -hl /Users/crifan/Library/Python/2.7/bin
total 80
-rwxr-xr-x  1 crifan  staff   253B  4 17 10:19 easy_install
-rwxr-xr-x  1 crifan  staff   253B  4 17 10:19 easy_install-2.7
-rwxr-xr-x  1 crifan  staff   242B  4 17 10:19 pewtwo
-rwxr-xr-x  1 crifan  staff   215B  4 20 15:26 pip
-rwxr-xr-x  1 crifan  staff   215B  4 20 15:26 pip2
-rwxr-xr-x  1 crifan  staff   215B  4 20 15:26 pip2.7
-rwxr-xr-x  1 crifan  staff   226B  4 17 10:19 pipenv
-rwxr-xr-x  1 crifan  staff   237B  4 17 10:19 pipenv-resolver
-rwxr-xr-x  1 crifan  staff   237B  4 17 10:19 virtualenv-clone
-rwxr-xr-x  1 crifan  staff   212B  4 20 15:26 wheel
</code>

另外,再去看看之前的PATH的路径:

<code>/Users/crifan/Library/Python/3.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
</code>

中不同路径下面,和python相关的:

<code>➜  robotDemo ll /usr/local/bin/py*
lrwxr-xr-x  1 crifan  admin    35B  4 17 10:52 /usr/local/bin/pydoc3 -&gt; ../Cellar/python/3.6.4_4/bin/pydoc3
lrwxr-xr-x  1 crifan  admin    37B  4 17 10:52 /usr/local/bin/pydoc3.6 -&gt; ../Cellar/python/3.6.4_4/bin/pydoc3.6
-rwxr-xr-x  1 crifan  admin   244B 12 26 20:49 /usr/local/bin/pyhtmlizer
-rwxr-xr-x  1 crifan  admin   240B  9 13  2017 /usr/local/bin/pylint
-rwxr-xr-x  1 crifan  admin   246B  9 13  2017 /usr/local/bin/pyreverse
lrwxr-xr-x  1 crifan  admin    36B  4 17 10:52 /usr/local/bin/python3 -&gt; ../Cellar/python/3.6.4_4/bin/python3
lrwxr-xr-x  1 crifan  admin    43B  4 17 10:52 /usr/local/bin/python3-config -&gt; ../Cellar/python/3.6.4_4/bin/python3-config
lrwxr-xr-x  1 crifan  admin    38B  4 17 10:52 /usr/local/bin/python3.6 -&gt; ../Cellar/python/3.6.4_4/bin/python3.6
lrwxr-xr-x  1 crifan  admin    45B  4 17 10:52 /usr/local/bin/python3.6-config -&gt; ../Cellar/python/3.6.4_4/bin/python3.6-config
lrwxr-xr-x  1 crifan  admin    39B  4 17 10:52 /usr/local/bin/python3.6m -&gt; ../Cellar/python/3.6.4_4/bin/python3.6m
lrwxr-xr-x  1 crifan  admin    46B  4 17 10:52 /usr/local/bin/python3.6m-config -&gt; ../Cellar/python/3.6.4_4/bin/python3.6m-config
lrwxr-xr-x  1 crifan  admin    35B  4 17 10:52 /usr/local/bin/pyvenv -&gt; ../Cellar/python/3.6.4_4/bin/pyvenv
lrwxr-xr-x  1 crifan  admin    39B  4 17 10:52 /usr/local/bin/pyvenv-3.6 -&gt; ../Cellar/python/3.6.4_4/bin/pyvenv-3.6
➜  robotDemo ll /usr/local/bin/pip*
-rwxr-xr-x  1 crifan  admin   235B  4 20 15:21 /usr/local/bin/pip
-rwxr-xr-x  1 crifan  admin   235B  4 17 10:18 /usr/local/bin/pip2
-rwxr-xr-x  1 crifan  admin   235B  4 17 10:18 /usr/local/bin/pip2.7
-rwxr-xr-x  1 crifan  admin   235B  4 20 15:21 /usr/local/bin/pip3
-rwxr-xr-x  1 crifan  admin   235B  4 20 15:21 /usr/local/bin/pip3.6
</code>

然后去看看:

/usr/local/bin

下面的pip和python:

<code>➜  robotDemo /usr/local/bin/pip --version
pip 10.0.1 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)
➜  robotDemo /usr/local/bin/pip2 --version
zsh: /usr/local/bin/pip2: bad interpreter: /usr/local/opt/python/bin/python2.7: no such file or directory
➜  robotDemo /usr/local/bin/pip2.7 --version
zsh: /usr/local/bin/pip2.7: bad interpreter: /usr/local/opt/python/bin/python2.7: no such file or directory
➜  robotDemo /usr/local/bin/pip3 --version
pip 10.0.1 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)
➜  robotDemo /usr/local/bin/pip3.6 --version
pip 10.0.1 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)
</code>

再去看看:

/usr/bin/

下面的pip和python:

<code>➜  robotDemo ll /usr/bin/pip*
ls: /usr/bin/pip*: No such file or directory
➜  robotDemo ll /usr/bin/py*
-rwxr-xr-x  4 root  wheel   925B  7 16  2017 /usr/bin/pydoc
lrwxr-xr-x  1 root  wheel    74B 11 15 12:14 /usr/bin/pydoc2.7 -&gt; ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/pydoc2.7
-rwxr-xr-x  1 root  wheel    65K  3 28 12:02 /usr/bin/python
-rwxr-xr-x  4 root  wheel   925B  7 16  2017 /usr/bin/python-config
lrwxr-xr-x  1 root  wheel    75B 11 15 12:14 /usr/bin/python2.7 -&gt; ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7
lrwxr-xr-x  1 root  wheel    82B 11 15 12:14 /usr/bin/python2.7-config -&gt; ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-config
-rwxr-xr-x  1 root  wheel    65K  3 28 12:02 /usr/bin/pythonw
lrwxr-xr-x  1 root  wheel    76B 11 15 12:14 /usr/bin/pythonw2.7 -&gt; ../../System/Library/Frameworks/Python.framework/Versions/2.7/bin/pythonw2.7
➜  robotDemo /usr/bin/python --version
Python 2.7.10
</code>

以及:

<code>➜  robotDemo ll /bin/pip*
ls: /bin/pip*: No such file or directory
➜  robotDemo ll /bin/py*
ls: /bin/py*: No such file or directory
➜  robotDemo ll /usr/sbin/pip*
ls: /usr/sbin/pip*: No such file or directory
➜  robotDemo ll /usr/sbin/py*
ls: /usr/sbin/py*: No such file or directory
➜  robotDemo ll /sbin/pip*
ls: /sbin/pip*: No such file or directory
➜  robotDemo ll /sbin/py*
ls: /sbin/py*: No such file or directory
</code>

还是不行,所以去手动把所用的python解析器改为python2的:

<code>➜  bin /usr/local/bin/pip --version
pip 10.0.1 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)
➜  bin ll /usr/local/bin/pip
-rwxr-xr-x  1 crifan  admin   235B  4 20 15:21 /usr/local/bin/pip
➜  bin cat /usr/local/bin/pip
#!/usr/local/opt/python/bin/python3.6

# -*- coding: utf-8 -*-
import re
import sys

from pip._internal import main

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
    sys.exit(main())
➜  bin vi /usr/local/bin/pip
➜  bin cat /usr/local/bin/pip
#!/usr/bin/python

# -*- coding: utf-8 -*-
import re
import sys

from pip._internal import main

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
    sys.exit(main())
</code>

然后再去看看结果pip是否从3变成2的

终于变过来了:

<code>➜  bin /usr/local/bin/pip --version
pip 10.0.1 from /Users/crifan/Library/Python/2.7/lib/python/site-packages/pip (python 2.7)
</code>

然后再去继续重新安装:

<code>➜  bin python -m pip install -U --force-reinstall pip
Collecting pip
  Using cached https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl
pipenv 11.10.0 requires certifi, which is not installed.
pipenv 11.10.0 requires requests[security], which is not installed.
pipenv 11.10.0 requires virtualenv, which is not installed.
matplotlib 1.3.1 requires nose, which is not installed.
matplotlib 1.3.1 requires tornado, which is not installed.
Installing collected packages: pip
  Found existing installation: pip 10.0.1
    Uninstalling pip-10.0.1:
      Successfully uninstalled pip-10.0.1
  Rolling back uninstall of pip
Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/Library/Python/2.7/site-packages/pip-10.0.1.dist-info'
Consider using the `--user` option or check the permissions.

➜  bin python -m pip install -U --force-reinstall pip --user
Collecting pip
  Using cached https://files.pythonhosted.org/packages/0f/74/ecd13431bcc456ed390b44c8a6e917c1820365cbebcb6a8974d1cd045ab4/pip-10.0.1-py2.py3-none-any.whl
pipenv 11.10.0 requires certifi, which is not installed.
pipenv 11.10.0 requires requests[security], which is not installed.
pipenv 11.10.0 requires virtualenv, which is not installed.
matplotlib 1.3.1 requires nose, which is not installed.
matplotlib 1.3.1 requires tornado, which is not installed.
Installing collected packages: pip
  Found existing installation: pip 10.0.1
    Uninstalling pip-10.0.1:
      Successfully uninstalled pip-10.0.1
Successfully installed pip-10.0.1
➜  bin which pip
pip: aliased to noglob pip
➜  bin where pip
pip: aliased to noglob pip
/usr/local/bin/pip
➜  bin /usr/local/bin/pip --version
pip 10.0.1 from /Users/crifan/Library/Python/2.7/lib/python/site-packages/pip (python 2.7)
➜  bin ll /usr/local/bin/pip
-rwxr-xr-x  1 crifan  admin   215B  4 20 15:47 /usr/local/bin/pip
</code>

好像是没什么效果的。

不过不论如何,此处新开终端,至少是可以找到python2的pip了:

<code>Last login: Fri Apr 20 14:34:13 on ttys007                                                                                                                                                            ➜  ~ which pip
pip: aliased to noglob pip
➜  ~ where pip
pip: aliased to noglob pip
/usr/local/bin/pip
➜  ~ pip --version
pip 10.0.1 from /Users/crifan/Library/Python/2.7/lib/python/site-packages/pip (python 2.7)
➜  ~
</code>

所以,此处,把pip从python3换成python2的任务,算是完成了。

【总结】

此处,之前的pip,是:

<code>➜  bin /usr/local/bin/pip --version
pip 10.0.1 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)
➜  bin ll /usr/local/bin/pip
-rwxr-xr-x  1 crifan  admin   235B  4 20 15:21 /usr/local/bin/pip
➜  bin cat /usr/local/bin/pip
#!/usr/local/opt/python/bin/python3.6

# -*- coding: utf-8 -*-
import re
import sys

from pip._internal import main

if __name__ == '__main__':
    sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
    sys.exit(main())
</code>

即:

从pip是:/usr/local/bin/pip

然后内部是用python解析器:/usr/local/opt/python/bin/python3.6

所以出来的pip –version

是3.6的

最后把:

<code>#!/usr/local/opt/python/bin/python3.6
</code>

改为:

<code>#!/usr/bin/python
</code>

然后再去看看pip就是python2的了:

<code>➜  bin /usr/local/bin/pip --version
pip 10.0.1 from /Users/crifan/Library/Python/2.7/lib/python/site-packages/pip (python 2.7)
</code>

暂时就不深究了。

转载请注明:在路上 » 【已解决】Mac中把Python3的pip重新换成Python2的pip

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
83 queries in 0.217 seconds, using 22.21MB memory