安装了python后怎么获得pip3,使用自制软件安装python后如何更改pip3路径?

I previously installed Python 3 through the official distribution but recently decided to use Homebrew. I followed this to change my Python 3 path:

Homebrew not linking python correctly?

This is how my python 3 path looks (which is what I want):

$which python

/usr/local/bin/python

$python --version

Python 3.7.5

However, now pip is using the official distribution but I want to change it to the Homebrew version

$which pip

/Library/Frameworks/Python.framework/Versions/3.6/bin/pip

$pip --version

pip 19.3.1 from /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip (python 3.6)

How do I change my pip path to the Homebrew version and remove the official distribution safely?

解决方案

You need to remove /Library/Frameworks/Python.framework from your PATH. That was added when you installed Python from the official distribution). Or, at least not put it at the beginning, so that Homebrew's Python (the one in /usr/local/bin) will be the one used by your system.

In your ~/.bash_profile, try this:

export PATH="/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"

then restart your Terminal or source ~/.bash_profile. Homebrew's pip should be in /usr/local/bin, installed along with Homebrew's Python.

That should also have been the fix for the system not using Homebrew's Python.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值