在Mac OS 10.14 Mojave上使用默认python安装pip

2024-05-16 21:32:44 发布

您现在位置:Python中文网/ 问答频道 /正文

我想在Mac OS上为Python的默认安装安装安装pip

请不要推荐brew,我已经有了它并安装了Python 3,但Automator似乎只知道如何使用位于/usr/bin/Python中的Python默认版本,这就是我特定请求的原因

在提问之前,我先做了家庭作业,或者试着做了,但我发现令人困惑的是,推荐的方法似乎是使用get-pip.py,但是pip文档中说

Warning Be cautious if you are using a Python install that is managed by your operating system or another package manager. get-pip.py does not coordinate with those tools, and may leave your system in an inconsistent state.

这让我很反感,因为我不想冒险破坏Mac OS上的默认Python,因为我知道这可能会弄乱我的系统

我也不想使用不推荐的easy_安装

我找不到我的问题的答案,因为答案通常只是建议使用brew安装不同版本的Python


Tags: pip答案py版本yourgetbinos
2条回答

Please don't recommend brew, I already have it and installed Python 3 with it, but it seems that Automator only knows how to use the default version of Python located in /usr/bin/python That's the reason behind my specific request

您可以在Automator中使用“runshell脚本”并指定要使用的python版本吗。见Specify which version of Python runs in Automator?https://apple.stackexchange.com/questions/233890/calling-python-3-script-from-applescript

问题

似乎Automator没有将/usr/local/cillar/bin加载到您的路径中。您可以在Automator中回显$PATH以确认这一点

解决方案

使用brew重新安装,并确保运行brew link python

您可以在运行脚本之前导出PATH=...,或者将/usr/bin/python移动到/usr/bin/pythonx.x,其中x是安装的默认版本,然后将/usr/bin/python符号链接到/usr/local/bin/中brew安装的python

相关问题 更多 >