I have several packages installed with pip which should/have been able to be run from the command line. For example, pipreqs
as well as a local package that I have created both have been and should run from the command line, respectively.
However, as soon as I upgraded to MacOS Catalina, the terminal changed from bash to zsh
. Now, no Python commands from the command-line are available. I beleve that this may be caused by the bash_profile
, but it seems to be configured correctly.
Are there any settings that must be modified or PATHs added to the bash_profile
upon upgrade? I have found that these commands all work when typing bash -login
and running them in bash in the terminal, but not in zsh.
Contents of ~/.bash_profile
:
export VARENV="kt2LrUtW8UVwMO3axMa8l4byPbs"
# Setting PATH for Python 3.6
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.6/bin:${PATH}"
export PATH
# Setting PATH for Python 3.8
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.8/bin:${PATH}"
export PATH
# Setting PATH for Python 3.8
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.8/bin:${PATH}"
export PATH
# Setting PATH for Python 3.8
# The original version is saved in .bash_profile.pysave
PATH="/Library/Frameworks/Python.framework/Versions/3.8/bin:${PATH}"
export PATH
# support python packages
export PATH=$PATH:~/.local/bin
# support pipreqs
export PATH=${PATH}:/usr/local/bin/pipreqs/pipreqs.py
test -e "${HOME}/.iterm2_shell_integration.bash" && source "${HOME}/.iterm2_shell_integration.bash"
export PATH="$HOME/.cargo/bin:$PATH"
Attempting to run pipreqs (or other command-line modules):
~ pipreqs -h
zsh: command not found: pipreqs
Python version: 3.8
pipreqs
found when running python3 -m pip list
(since pip list
and pip3 list
only show up for Python 2).
Edit: running the following commands gives the following results
echo "$PATH" | tr : '\n'
/usr/local/bin
/usr/bin
/bin
/usr/sbin
/sbin
/usr/local/go/bin
/usr/local/munki
/opt/X11/bin
trying to reinstall pipreqs
:
Installing collected packages: pipreqs
WARNING: The script pipreqs is installed in '/Library/Frameworks/Python.framework/Versions/3.8/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pipreqs-0.4.10 –
SOLUTION:
The contents of .zshrc
are different from .bash_profile
. You need to migrate them in order to support Python and the libraries.
- type
open ~/.bash_profile
- type
open ~/.zshrc
- copy the PATH for Python 3 to
.zshrc
and add the following line:export PATH=$PATH:~/.local/bin
- save the file
- go back the terminal, and type
source ~/.zshrc
- restart terminal and it works