Python 如何从 Pycharm 访问不同的 Anaconda 环境(在 Windows 10 上)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/41767788/
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
How can I access different Anaconda environment from Pycharm (on Windows 10)
提问by PatriceG
I have installed anaconda with python 3.5, and created a new environment with Python 2.7 (on windows 10).
我已经使用 python 3.5 安装了 anaconda,并使用 Python 2.7(在 Windows 10 上)创建了一个新环境。
I can easily change the Anaconda environment with the command line tool. However in Pycharm, when I try to change the Python interpreter, I can only see the Anaconda Python 3.5 version.
我可以使用命令行工具轻松更改 Anaconda 环境。但是在 Pycharm 中,当我尝试更改 Python 解释器时,我只能看到 Anaconda Python 3.5 版本。
Is there a easy way to select the Anaconda environment from Pycharm?
有没有一种简单的方法可以从 Pycharm 中选择 Anaconda 环境?
回答by Giordano
In PyCharm you can add how many interpreter you want. You have to go in
在 PyCharm 中,您可以添加所需的解释器数量。你必须进去
Settings->Project->Project Interpreter
Here, you should see the current interpreter.
At the top of the window, there is a list which contains all local interpreters.
If you find it in the list select it, otherwise, in the right corner of the window, there is a settings
icon; press it and press on Add local
.
After this navigate in your computer and select the directory that contains the Anaconda env.
在这里,您应该看到当前的解释器。
在窗口顶部,有一个包含所有本地解释器的列表。
如果您在列表中找到它,请选择它,否则,在窗口的右上角,有一个settings
图标;按下并按下Add local
。
在此之后,在您的计算机中导航并选择包含 Anaconda 环境的目录。
edit
As PatriceG suggested in comments, if you already have an Anaconda environment but you don't know where is it or you don't remember, you can check the current position using the following command:
编辑
正如 PatriceG 在评论中建议的那样,如果您已经有一个 Anaconda 环境但您不知道它在哪里或您不记得了,您可以使用以下命令检查当前位置:
conda info --envs
Then, you should be able to find and select it.
然后,您应该能够找到并选择它。
Now, you have to add the anconda env to your local interpreter, so you are able to use it.
现在,您必须将 anconda env 添加到您的本地解释器中,以便您能够使用它。
回答by Ameer Hamza
Go to Settingthen Project InterpreterClick on Setting icon which will lead to browse folder, Choose Add Localthen on left side of page, click on system Interpreterthen Press OK and Apply.
转到设置然后项目解释器单击设置图标,这将导致浏览文件夹,选择添加本地然后在页面左侧,单击系统解释器,然后按确定并应用。