问题
Sorry if this is a stupid question. I use python/jupyter a lot and it's stopped working after updating from Mac OS High Sierra to Big Sur. I'm trying to figure out why, but I'm not great with command line stuff.
The problem. When I try python3
, pip -v
, conda
, etc. it says "command not found". python
still seems to run, but it's 2.7 and I know I had 3 (I probably had a few versions from untidy file systems). I want to avoid reinstalling all my packages and things again, because I know it's still there and I've done this a few times already.
Some clues. I know this OS upgrade moves me from bash to zsh. I've tried just switching back to bash with chsh -s /bin/zsh
but it still says command not found. I also noticed the OS update creates a Mac HD (below System/Volumes) within my Mac HD, and in that second one seems to be still all my python3/conda/pip/etc. folders. Not sure if/how this matters. Or if this is just a path issue.
I just want to get Jupyter running again on my Mac without reinstalling all my myriad packages from square one. Any help appreciated!
回答1:
After extreme toil and research, I finally found something that worked for me.
- Find the location of your Anaconda3. For me it was in
~/opt/anaconda3
- Open terminal and type
source <location of anaconda3>/bin/activate
and then
in the next line, writeconda init zsh
- Close your terminal and open it again. You should see a prefix
(base)
when you open it again.
All in all, for me it was
rko3 ~ % source opt/anaconda3/bin/activate
rko3 ~ % conda init zsh
Let me know if this works for you!
PS. You may be tempted to change $PATH variables. Anaconda advises against that. Use this reference instead that suggests the above. https://docs.anaconda.com/anaconda/install/mac-os/
回答2:
Seems like your environement is not activated. Zsh sources ~/.zshrc while bash sources ~/.bashrc. You can copy lines related to conda from your ~/.bashrc to your ~/.zshrc.
AF
来源:https://stackoverflow.com/questions/65120490/mas-os-big-sur-update-python3-conda-pip-not-found