问题
I've just updated my MacBook to Catalina. After the update, zsh can't find anymore. In fact, in my .zshrc I had:
export PATH=/anaconda3/bin:$PATH
However, the path /anaconda3/bin doesn't exist anymore. Does that mean that I have lost all of my environment?
回答1:
You can find the entire anaconda3 environment in a shortcut link named 'Relocated Items' on your desktop. It appears as though the upgrade to Catalina does not allow the Conda environment to be installed under a user directory now likely having to do with the new system volume move to a read-only partition.
This issue has been opened as far back as June 10th, I am a little disappointed that it was not resolved before the Catalina upgrade came around.
There is a solution that appears to work without losing your environment, see this link: https://github.com/ContinuumIO/anaconda-issues/issues/10998#issuecomment-539215005
From the link:
Copy the folder anaconda3 located in Relocated Items to /Users/myname/
Open Terminal
Enter:
export PATH='/Users/myname/anaconda3/bin:$PATH'
Enter:
conda init zsh
回答2:
Anaconda has published a blog post on the issue. There seem to be two main options:
Reinstallation: for now shell installer only (you’ll need to wait for the new installer if you rely on the GUI instead).
Repair (experimental): will allow you to fix your old installation and keep all of your old environments
You can check the Anaconda website for further information.
回答3:
If you are using zsh
, conda installer adds a conda init script at the end of your ~/.bash_profile
file. You should copy it and paste into your ~/.zshrc
file.
回答4:
use this (do not use double " )
export PATH='/Users/myname/anaconda3/bin:$PATH'
回答5:
I was able to develop a workaround for this issue by installing miniconda from Homebrew (https://brew.sh/). After installing Homebrew, type the following into Terminal:
brew cask install miniconda
Once miniconda is installed, conda commands should be accessible through Terminal and you may also want to run conda update conda
to ensure the packages in your environment are consistent.
Finally, you may have to change your approach to opening Anaconda tools such as Jupyter Notebook. Such tools can be accessed via Terminal with the prefix conda run ...
For example:
conda run jupyter notebook
will open Jupyter Notebook, but the command
jupyter notebook
might not work. A similar question was asked on this post.
回答6:
I reinstalled anaconda via the mac terminal and it works fine.
回答7:
I followed this post and it worked (I did it for python 3). Summary of steps:
- Relocate anaconda3 folder from
Relocated Items
to you home - Download the the command line installer for Anaconda3
- Make the install script executable (
chmod +x
) Run the installer with the
-u
option to upgrade an existing Anaconda installation:./<name of anaconda installer> -u
add this line to your
.bash_profile
:export PATH="/Users/<username>/anaconda3/bin:$PATH"
回答8:
I installed the anaconda successfully through command mode, still was not running.
So, conda was installed but not activated.
My steps to solution:
- restart computer
- source ~/anaconda/bin/activate
(in terminal; activation needs to run successfully)
- conda init
(needs to run without any error)
- conda config --set auto_activate_base True
(this will activate conda automatically to run conda)
- if you don't want auto activation, give the argument "False" instead of "True". each time before running conda, you will have to execute "conda init"
This also solved another problem - my spyder was not running from navigator. Now it's running fine.
If it does not work, let me know.
回答9:
None of the existing answers worked for me but this one does.
Download anaconda's self-contained prefix replacement tool at https://repo.anaconda.com/pkgs/misc/cpr-exec/cpr-0.1.1-osx-64.exe and make it executable:
curl -L https://repo.anaconda.com/pkgs/misc/cpr-exec/cpr-0.1.1-osx-64.exe -o cpr && chmod +x cpr
Move your anaconda3 folder from Relocated Items to your home folder: ~/anaconda3.
Fix your folder using the following command:
./cpr rehome ~/anaconda3
Re-run conda init to fix your conda shell command:
source ~/anaconda3/bin/activate conda init
If you are using zsh,replace the last command with:
conda init zsh
回答10:
Copy anaconda3/ path to /Users/<my_user>/
Then export PATH='/Users/<my_user>/anaconda3/bin:$PATH'
Edit file:
/Users/<my_user>/anaconda3/conda
Edit the first line like:
FROM #!//anaconda3/bin/python
TO #!/Users/<my_user>/anaconda3/bin/python
Save changes to /Users/<my_user>/anaconda3/bin/conda init zsh
Should work
来源:https://stackoverflow.com/questions/58291108/conda-not-found-after-upgrading-to-macos-catalina