简体   繁体   English

PyCharm:找不到Anaconda安装

[英]PyCharm: Anaconda installation is not found

I had Anaconda on Windows 10 installed in C:\\ProgramData\\Anaconda3 before using PyCharm. 在使用PyCharm之前,我在Windows 10上安装了Anaconda,安装在C:\\ ProgramData \\ Anaconda3中。 Now PyCharm displays: "Anaconda installation is not found" when I try using a conda env. 现在PyCharm显示:当我尝试使用conda env时,“找不到Anaconda安装”。

I also added Anaconda to PATH. 我还向PATH添加了Anaconda。

Is there a way to show PyCharm where Anaconda is installed? 有没有办法向PyCharm展示安装Anaconda的位置?

There is an open bug, currently PyCharm and IDEA both seem to detect Conda installation only from %HOMEPATH%/anaconda. 有一个开放的bug,目前PyCharm和IDEA似乎都只检测来自%HOMEPATH%/ anaconda的Conda安装。 https://youtrack.jetbrains.com/issue/PY-26923 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. 请注意,C:\\ ProgramData \\ Anaconda3应替换为Anconda安装的路径。 If you selected to installed it for "Just Me" instead of "All Users", your default location will be 如果您选择将其安装为“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. 更新:自2018.1版以来,此问题现已在IDEA和PyCharm中修复。 You can specify a custom path under Python Interpreter or SDK settings in Conda Environment section. 您可以在Conda Environment部分的Python Interpreter或SDK设置下指定自定义路径。

You can't find anaconda python in your console at first.Click Configure Interpreters in blue. 您最初在控制台中找不到anaconda python。单击配置蓝色的解释器。

在此输入图像描述

Click the little gear under reset in blue(right + up corner), and chose 'add local'. 点击蓝色重置的小齿轮(右+上角),然后选择'添加本地'。 在此输入图像描述 point to your python in anaconda 指向anaconda中的python

在此输入图像描述

Here you are 这个给你

在此输入图像描述

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,否则在尝试创建符号链接时将收到权限错误。

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. 卸载随Visual Studio 2017安装的Anaconda。我通过取消VS2017安装程序中的选项来完成此操作。
  • Installing Anaconda after downloading the official installer . 下载官方安装程序后安装Anaconda。
  • Rebooting my PC. 重新启动我的电脑。

My theory is that VS2017 installs Anaconda in a non-default location, and PyCharm cannot find it. 我的理论是VS2017在非默认位置安装Anaconda,而PyCharm找不到它。 The Anaconda installer states that VS2017 should still work fine with Python, even after this change. Anaconda安装程序声明,即使在此更改之后,VS2017仍然可以正常使用Python。

I faced the same issue on Ubuntu 16.04 where I had Anaconda installed under ~/.local/opt/anaconda3 . 我在Ubuntu 16.04上遇到了同样的问题,我在An ~/.local/opt/anaconda3下安装了Anaconda。 Creating a symlink under ~/anaconda3 solved the issue for me. ~/anaconda3下创建一个符号链接为我解决了这个问题。

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

I had a similar problem running linux (Ubuntu) because I installed anaconda to a custom location. 我有一个类似的问题运行Linux(Ubuntu)因为我将anaconda安装到自定义位置。 Creating a symbolic link to anaconda in home directory solved the problem. 在主目录中创建指向anaconda的符号链接解决了这个问题。

You can run the following command to do that: 您可以运行以下命令来执行此操作:

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和用户名的自定义路径

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM