PYTHONPATH 环境变量未在 macOS 上保存

PYTHONPATH environment variable not saving on macOS

运行 echo $PYTHONPATH return一个空行:

freddy@dave ~ % echo $PYTHONPATH

freddy@dave ~ %

echo $PATH return正确

freddy@dave ~ % echo $PATH
/opt/homebrew/bin:/opt/homebrew/sbin: ...

.bash_profile 用户 freddy:

# Fig pre block. Keep at the top of this file.
export PATH="${PATH}:${HOME}/.local/bin"
eval "$(fig init bash pre)"

# Use Python 3.10, not homebrew
export PYTHONPATH="/Library/Frameworks/Python.framework/Versions/3.10/bin/python3.10"

export PATH="/opt/homebrew/bin:${PATH}"
source ~/.bash_profile

# Fig post block. Keep at the bottom of this file.
eval "$(fig init bash post)"% 

为什么 echo $PYTHONPATH return 什么都没有?我如何将它分配给我的 Python3.10 路径?

正如评论所暗示的那样,我正在尝试使用 Python3.10 而不是我的 Homebrew 安装,它适用于某些系统包

我正在使用 zsh,而不是 bash


我将 PYTHONPATH 移动到 .zshrc,它现在保存为环境变量。

但是,我选择了 pyenv 设置。并将以下内容添加到我的 .zshrc 文件中:

eval "$(pyenv init --path)"