windows PyCharm:找不到 Anaconda 安装

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/47624777/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 20:00:23  来源:igfitidea点击:

PyCharm: Anaconda installation is not found

windowspathinstallationpycharmanaconda

提问by AstronAUT

I had Anaconda on Windows 10 installed in C:\ProgramData\Anaconda3 before using PyCharm. Now PyCharm displays: "Anaconda installation is not found" when I try using a conda env.

在使用 PyCharm 之前,我在 C:\ProgramData\Anaconda3 中安装了 Windows 10 上的 Anaconda。现在,当我尝试使用 conda env 时,PyCharm 显示:“未找到 Anaconda 安装”。

I also added Anaconda to PATH.

我还将 Anaconda 添加到 PATH。

Is there a way to show PyCharm where Anaconda is installed?

有没有办法显示安装了 Anaconda 的 PyCharm?

回答by Ahti Kitsik

There is an open bug, currently PyCharm and IDEA both seem to detect Conda installation only from %HOMEPATH%/anaconda. https://youtrack.jetbrains.com/issue/PY-26923

有一个开放的错误,目前 PyCharm 和 IDEA 似乎都只能从 %HOMEPATH%/anaconda 检测到 Conda 安装。https://youtrack.jetbrains.com/issue/PY-26923

The easiest workaround is to create a symlink to $HOME/.anaconda

最简单的解决方法是创建一个指向 $HOME/.anaconda 的符号链接

mklink /D %HOMEDRIVE%%HOMEPATH%\anaconda C:\ProgramData\Anaconda3

Note that C:\ProgramData\Anaconda3 should be replaced with the path to your Anconda installation. If you selected to installed it for "Just Me" instead of "All Users", your default location will be

请注意,应将 C:\ProgramData\Anaconda3 替换为 Anconda 安装的路径。如果您选择为“Just Me”而不是“All Users”安装它,您的默认位置将是

C:\Users\<your_username>\AppData\Local\Continuum\anaconda3

UPDATE:This issue is now fixed in IDEA and PyCharm since version 2018.1. You can specify a custom path under Python Interpreter or SDK settings in Conda Environment section.

更新:自 2018.1 版起,此问题现已在 IDEA 和 PyCharm 中得到修复。您可以在 Conda 环境部分的 Python 解释器或 SDK 设置下指定自定义路径。

回答by Tina Liu

You can't find anaconda python in your console at first.Click Configure Interpreters in blue.

首先在控制台中找不到 anaconda python。单击蓝色的配置解释器。

enter image description here

在此处输入图片说明

Click the little gear under reset in blue(right + up corner), and chose 'add local'. enter image description herepoint to your python in anaconda

单击蓝色(右+上角)重置下的小齿轮,然后选择“添加本地”。 在此处输入图片说明在 anaconda 中指向你的 python

enter image description here

在此处输入图片说明

Here you are

这个给你

enter image description here

在此处输入图片说明

回答by Chenhua

In @Ahti Kitsik's answer above, the following line did not work, and resulted in a an error: mklink /D %HOMEPATH%\anaconda C:\ProgramData\Anaconda3

在上面@Ahti Kitsik 的回答中,以下行不起作用,并导致错误: mklink /D %HOMEPATH%\anaconda C:\ProgramData\Anaconda3

Because of a different install location, the following worked for me:

由于安装位置不同,以下对我有用:

mklink /D "%HOMEPATH%\anaconda" "C:\Dev\Anaconda3"

"C:\Dev\Anaconda3" should be the anaconda installation folder on your PC.

“C:\Dev\Anaconda3”应该是你PC上的anaconda安装文件夹。

Also, be sure to run the cmd with administrator privilege, otherwise you will get a permission error when trying to create the symlink.

另外,请务必以管理员权限运行 cmd,否则在尝试创建符号链接时会出现权限错误。

回答by Contango

I fixed this by:

我通过以下方式解决了这个问题:

  • Uninstalling the Anaconda that was installed with Visual Studio 2017. I did this by unticking the option within the VS2017 installer.
  • Installing Anaconda after downloading the official installer.
  • Rebooting my PC.
  • 卸载与 Visual Studio 2017 一起安装的 Anaconda。我通过取消选中 VS2017 安装程序中的选项来完成此操作。
  • 下载官方安装程序后安装Anaconda 。
  • 重新启动我的电脑。

My theory is that VS2017 installs Anaconda in a non-default location, and PyCharm cannot find it. The Anaconda installer states that VS2017 should still work fine with Python, even after this change.

我的理论是VS2017在非默认位置安装Anaconda,PyCharm找不到。Anaconda 安装程序指出 VS2017 应该仍然可以与 Python 一起正常工作,即使在此更改之后也是如此。

回答by Theodros Zelleke

I faced the same issue on Ubuntu 16.04 where I had Anaconda installed under ~/.local/opt/anaconda3. Creating a symlink under ~/anaconda3solved the issue for me.

我在 Ubuntu 16.04 上遇到了同样的问题,我在~/.local/opt/anaconda3. 在下面创建符号链接~/anaconda3为我解决了这个问题。

回答by LeoZ

mklink /D %HOMEDRIVE%%HOMEPATH%\anaconda "C:\Program Files\Anaconda3"

mklink /D %HOMEDRIVE%%HOMEPATH%\anaconda "C:\Program Files\Anaconda3"

回答by Smartens

I had a similar problem running linux (Ubuntu) because I installed anaconda to a custom location. Creating a symbolic link to anaconda in home directory solved the problem.

我在运行 linux (Ubuntu) 时遇到了类似的问题,因为我将 anaconda 安装到了自定义位置。在主目录中创建到 anaconda 的符号链接解决了这个问题。

You can run the following command to do that:

您可以运行以下命令来执行此操作:

ln -s /_my_custom_path_to_/anaconda3/ /home/_my_user_name_/anaconda3

ln -s /_my_custom_path_to_/anaconda3/ /home/_my_user_name_/anaconda3

* keep in mind _my_custom_path_to_and _my_user_name_/are your custom path to anaconda and user name correspondingly

* 请记住_my_custom_path_to__my_user_name_/是您自定义的 anaconda 路径和相应的用户名