0

Running echo $PYTHONPATH returns a blank line:

freddy@dave ~ % echo $PYTHONPATH

freddy@dave ~ %

echo $PATH returns properly

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

.bash_profile for user 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)"% 

Why does echo $PYTHONPATH return nothing? And how do I assign it to my Python3.10 path?

  • I've tried restarting, this does not help
  • I've run source ~/.bash_profile (this just closes the terminal after execution though?)
  • A test variable: export TEST="TEST" also echos a blank line

As the comment suggests, I'm trying to use Python3.10 instead of my Homebrew installation, which is for some system packages

2
  • "(this just closes the terminal after execution though?)" - Do you have an exit in .bash_profile? - Then remove it. Commented Apr 12, 2022 at 7:38
  • There is no exit. the entire file is shown above. Should i remove the source ~/.bash_profile from under PATH in the bash_profile? Commented Apr 12, 2022 at 7:52

1 Answer 1

1

I am using zsh, not bash.


I moved PYTHONPATH to .zshrc and it saves as an environment variable now.

However, I have opted for the pyenv setup. And have added the following to my .zshrc file:

eval "$(pyenv init --path)"

https://stackoverflow.com/a/69378384/14141223

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.