本文介绍了如何使Conda和Virtualenv在Mac OS Catalina上工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以前曾让Conda在Mojave上顺利运行,但是我发现升级到Catalina会将"anaconda3"文件夹移至桌面">重定位项">安全性">"anaconda3".似乎Catalina的安全设置可能不再允许应用程序直接安装在用户目录下.

I previously had Conda running smoothly on Mojave, but I've found that the upgrade to Catalina moves the "anaconda3" folder to your Desktop > Relocated Items > Security > anaconda3. It seems Catalina's security settings may not allow applications to install directly under the user directory anymore.

我尝试了此处的建议,写在下面:

I tried the suggestion here, written below:

  • 将位于重定位项"中的文件夹anaconda3复制到/Users/myname/
  • 打开终端
  • 输入:export PATH ="/Users/myname/anaconda3/bin:$ PATH"
  • 输入:conda init zsh
  • 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

成功了!祝你好运!

但这对我不起作用.在conda init zsh之后,我得到:

But this doesn't work for me. After conda init zsh I get:

如何在不丢失所有虚拟环境的情况下重新启动Conda并使其运行?谢谢!

How can I get Conda up and running again without losing all my virtual environments? Thanks!

更新

我按照@Ted Shaowang的建议让Conda上班.这意味着conda env list显示通过Conda创建的所有虚拟环境.

I got Conda to work following @Ted Shaowang's suggestion. This means that conda env list shows all the virtual environments created via Conda.

但是我仍然遇到virtualenv问题,因为自从我更改了默认的anaconda3文件位置以来,找不到python.

However I am still experiencing an issue with virtualenv as since I changed the default anaconda3 file locations, python cannot be found.

找不到位于.virtualenvs/env/bin/python的python可执行文件.我是否需要做进一步的更改才能使python从virtualenv开始工作?

The python executable located at .virtualenvs/env/bin/python cannot be found. Do I need to make further changes in order for python to work from virtualenv too?

推荐答案

我遇到了完全相同的问题,这对我有用:

I have the exact same problem and this works for me:

将anaconda从重新定位的项目"移至~/anaconda3后,将~/anaconda3/bin/conda文件的第一行从#!/anaconda3/bin/python修改为#!/Users/USERNAME/anaconda3/bin/python以反映更改.

After you move anaconda from "Relocated Items" to ~/anaconda3, edit the first line of ~/anaconda3/bin/conda file from #!/anaconda3/bin/python to #!/Users/USERNAME/anaconda3/bin/python to reflect the change.

这篇关于如何使Conda和Virtualenv在Mac OS Catalina上工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-14 18:42