问题描述
我试图通过在 Bash 中执行以下命令的变体来安装一些 Python 库:
I am attempting to install some Python libraries by executing variations of the following command in Bash:
pip install --user -U numpy
我使用 Homebrew 安装了 Python3.
I installed Python3 using Homebrew.
然后我每次都会收到以下消息的变体:
I then get variations of the following message each time:
警告:脚本 f2py、f2py3 和 f2py3.7 安装在不在 PATH 上的/Users/x/Library/Python/3.7/bin"中.考虑将此目录添加到 PATH 中,或者,如果您希望取消此警告,请使用 --no-warn-script-location.
我该如何解决这个问题以避免将来出现问题?
How can I fix this issue to avoid problems in the future?
推荐答案
错误消息告诉您将 Python 3 添加到您的路径中.
The error message is telling you to add Python 3 to your path.
为此,请使用文本编辑器打开 /Users//.profile
,并在最后一行添加:
To do that, use a text editor to open /Users/<you>/.profile
, and as the very last line add:
export PATH=/Users/<you>/Library/Python/3.8/bin:$PATH
然后您需要启动一个新的终端窗口以使这些设置生效.(您可以通过直接在 shell 中输入该行使其在当前 shell 中生效)
Then you'll need to launch a new Terminal window for those settings to take effect. (you could make it take effect in your current shell by entering the line directly into your shell)
这篇关于使用 Bash 修复 Python 库的 PATH的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!