问题描述
我在 Windows 的默认位置有一个 conda 环境,即 C:ProgramDataAnaconda2envsmyenv
.此外,按照建议,conda 脚本和可执行文件不在 %PATH%
环境变量中.我在 pycharm 中打开了一个项目,并将 python 解释器指向C:ProgramDataAnaconda2envsmyenvpython.exe
并且 pycharm 似乎与 python 控制台、运行环境和调试模式中的环境很好地配合.
I have a conda environment at the default location for windows, which is C:ProgramDataAnaconda2envsmyenv
. Also, as recommended, the conda scripts and executables are not in the %PATH%
environment variable.I opened a project in pycharm and pointed the python interpreter toC:ProgramDataAnaconda2envsmyenvpython.exe
and pycharm seems to work well with the environment in the python console, in the run environment, and in debug mode.
但是,当打开终端时,环境没有被激活(我确保激活环境的复选框被选中).需要明确的是 - 当我对 virtualenv 做同样的事情时,终端确实会毫无问题地激活环境.
However, when opening the terminal the environment is not activated (I made sure that the checkbox for activating the environment is checked). To be clear - when I do the same thing with a virtualenv the terminal does activate the environment without a problem.
以下是我尝试过但没有奏效的几件事:
Here are a few things I tried and did not work:
- 将anaconda文件夹中的activate脚本复制到环境文件夹中
- 将anaconda文件夹中的activate脚本复制到环境下的
Scripts
文件夹中 - 从 virtualenv 复制了一个激活脚本(与激活环境相同的脚本)
- 将 anaconda 文件夹添加到路径中
这些都不起作用.终端打开后我可以手动激活环境没有问题,但是如何自动激活呢?
None of these worked.I can manually activate the environment without a problem once the terminal is open, but how do I do it automatically?
推荐答案
这似乎是一个已知的问题.
这篇关于PyCharm 终端不激活 conda 环境的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!