英文:
How to access the Anaconda base environment in Pycharm when I cannot import C:\Users\username\Anaconda3\python.exe?
问题
抱歉,如果这个问题已经有重复的回答了。我查看了stackoverflow上所有类似的帖子,但没有一个对我的情况真正有帮助。
背景:
-
我对Pycharm和Anaconda都是完全陌生的,因为我多次因不同的问题而安装和卸载了它们。
-
在重新安装后,我在Pycharm中创建的新conda环境只包含了一些包。我在Anaconda Navigator中进行了检查,除了具有数百个包的标准Anaconda库的基本/根环境之外,我创建的所有新conda环境都只有相同的12个包。
-- 这些新的Pycharm conda环境还具有相同的conda可执行文件:
C:\Users\username\Anaconda3\Scripts\conda.exe
- 我不想为不同的conda环境安装相同的包 - 这不符合Anaconda的目的,对吧?当我试图在新的conda环境中将
C:\Users\username\Anaconda3\python.exe
添加为conda可执行文件,我一直都会收到相同的错误:
C:\Users\username\Anaconda3\python.exe: 无法打开文件 'create':
[Errno 2] 没有该文件或目录。
然而,一旦我点击“对所有项目可用”,PyCharm就允许了,但是使用此conda可执行文件在PyCharm上显示的包列表仍然只有相同的12个包。
-
我试图在
C:\Users\username\Anaconda3\bin\conda
中找到基本的Anaconda环境,但是我在其他地方看到的C:\Users\username\Anaconda3\bin
文件夹不存在。 -
我使用的是PyCharm 2019.3.1(专业版)和Anaconda3-2019.10-Windows-x86_64。
附言: 如果有人能推荐一些适合初学者的有关PyCharm和Anaconda的教程,我将不胜感激。不幸的是,我在学校没有学到这些内容。
英文:
Apologies if this question has been repetitive. I've looked up all the similar posts on stackoverflow but none really helped in my case.
Background:
-
I am absolutely new to Pycharm and Anaconda, both of which I've installed and un-installed multiple times due to different problems each time.
-
After a fresh installation, the new conda environments that I've created in Pycharm has only a few packages. I checked in Anaconda Navigator, and other than the base/root environment that has the standard Anaconda library of hundreds of packages, all the new conda environments created by me only had the same 12 packages.
-- These new Pycharm conda environments also had the same conda excutable:
C:\Users\username\Anaconda3\Scripts\conda.exe
- I didn't want to install the same packages for the different conda environments - it defeats the purpose of Anaconda, isn't it? As I sought to use the base/root Anaconda environment by adding
C:\Users\username\Anaconda3\python.exe
as the conda executable in new conda environments, I kept getting tbe same error:
> C:\Users\username\Anaconda3\python.exe: can't open file 'create':
> [Errno 2] No such file or directory.
Once I clicked 'Makee available to all projects', however, PyCharm allowed it, but the package list displayed on PyCharm with this conda executable still only has the same 12 packages.
-
I tried to look for the base Anaconda environment in
C:\Users\username\Anaconda3\bin\conda
, but the folderC:\Users\username\Anaconda3\bin
that I have seen everywhere else doesn't exist. -
I used PyCharm 2019.3.1(Professional Version) and Anaconda3-2019.10-Windows-x86_64.
P.S. Would greatly appreciate if someone can recommend some beginner-friendly tutorial on PyCharm and Anaconda. I don't learn about these in school, unfortunately.
答案1
得分: 1
"the new conda environments ... has only a few packages" => "新的conda环境...只有少数几个包"
"That's by design, environments don't inherit base packages by default." => "这是有意设计的,环境默认不继承基础包。"
"As I sought to use the base/root Anaconda environment by adding C:\Users\username\Anaconda3\python.exe as the conda executable" => "当我试图将C:\Users\username\Anaconda3\python.exe添加为conda可执行文件来使用基础/根Anaconda环境时"
"Conda executable != python.exe" => "conda可执行文件 != python.exe"
"Try adding new system interpreter pointing to python executable inside Anaconda installation. This should do the trick." => "尝试添加一个新的系统解释器,指向Anaconda安装内部的python可执行文件。这应该能解决问题。"
英文:
>the new conda environments ... has only a few packages
That's by design, environments don't inherit base packages by default.
>As I sought to use the base/root Anaconda environment by adding C:\Users\username\Anaconda3\python.exe as the conda executable
Conda executable != python.exe
Try adding new system interpreter pointing to python executable inside Anaconda installation. This should do the trick.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论