简体   繁体   English

PyCharm:在 macOS 上找不到 Anaconda 安装

[英]PyCharm: Anaconda installation is not found on macOS

PyCharm CE and Anaconda have been installed.已安装PyCharm CEAnaconda

I know I should create a symlink to $HOME/.anaconda , but what is the command on macOS/Linux ?我知道我应该创建一个指向$HOME/.anacondasymlink ,但是macOS/Linux上的命令是什么?

Or any other solution?还是有其他解决办法?

Thx谢谢

You can set which interpreter to use within PyCharm.您可以设置在 PyCharm 中使用哪个解释器。 First you can go to your terminal and check:首先,您可以转到终端并检查:

$ python --version

You may see something like this:你可能会看到这样的事情:

$ Python 3.6.4 :: Anaconda, Inc.

Verify the path to your interpreter:验证您的解释器的路径:

which python

or

$ python

>>> import sys
>>> sys.executable
'/anaconda3/bin/python'

Now go to PyCharm and navigate to:现在转到 PyCharm 并导航到:

pycharm > preferences (or simply ⌘, ) > project > project interpreter > settings icon > add local > system interpreter > ... button > /anaconda3/bin/python3.6 pycharm > 首选项(或简单的 ⌘, )> 项目 > 项目解释器 > 设置图标 > 添加本地 > 系统解释器 > ... 按钮 > /anaconda3/bin/python3.6

click apply点击申请

You'll have to scroll up to get to your anaconda directory and essentially manually set the project interpreter path to your sys.executable path by clicking through subdirectories.您必须向上滚动才能进入anaconda 目录,并通过单击子目录将项目解释器路径手动设置为您的sys.executable路径。

For 2020 readers, I'm using Mac OSX:对于 2020 年的读者,我使用的是 Mac OSX:

In PyCharm, click the Terminal Tab at the bottom, type在 PyCharm 中,单击底部的终端选项卡,键入

which python

and notice whether there is a .../.conda/... shown in the path.并注意路径中是否显示.../.conda/... In my case:就我而言:

/Users/raining/.conda/envs/ExampleProject/bin/python

If so, you're actually using anaconda's python(interpreter).如果是这样,您实际上是在使用 anaconda 的 python(解释器)。

  • Notice that python --version only showed Python 3.8.5 , no info.请注意, python --version仅显示Python 3.8.5 ,没有信息。 about Anaconda.关于蟒蛇。

Add the path in ~/.bashrc~/.bashrc添加路径

such as比如

export PATH="/anaconda3/bin:$PATH"

Then, PyCharm CE can be worked with Anaconda .然后, PyCharm CE可以与Anaconda一起使用。

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

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