gpt4 book ai didi

python - 无法激活现有的 conda 环境

转载 作者:行者123 更新时间:2023-12-04 10:50:24 38 4
gpt4 key购买 nike

我使用 Python3.7 在 Pycharm 中创建了一个名为 Practice 的 Conda 环境。我正在使用 Mac 并使用 Pycharm 终端(鱼),但是我使用 iterm2 收到相同的错误。

当我输入 conda activate Practice我收到以下错误:


Traceback (most recent call last):
File "/usr/local/anaconda3/lib/python3.7/site-packages/conda/cli/main.py", line 138, in main
return activator_main()
File "/usr/local/anaconda3/lib/python3.7/site-packages/conda/activate.py", line 1098, in main
print(activator.execute(), end='')
File "/usr/local/anaconda3/lib/python3.7/site-packages/conda/activate.py", line 182, in execute
return getattr(self, self.command)()
File "/usr/local/anaconda3/lib/python3.7/site-packages/conda/activate.py", line 156, in activate
builder_result = self.build_activate(self.env_name_or_prefix)
File "/usr/local/anaconda3/lib/python3.7/site-packages/conda/activate.py", line 301, in build_activate
return self._build_activate_stack(env_name_or_prefix, False)
File "/usr/local/anaconda3/lib/python3.7/site-packages/conda/activate.py", line 378, in _build_activate_stack
self._replace_prefix_in_path(old_conda_prefix, prefix))
File "/usr/local/anaconda3/lib/python3.7/site-packages/conda/activate.py", line 628, in _replace_prefix_in_path
if path_list[last_idx + 1] == library_bin_dir:
IndexError: list index out of range

`$ /usr/local/anaconda3/bin/conda shell.fish activate Practice`

environment variables:
CIO_TEST=<not set>
CONDA_DEFAULT_ENV=base
CONDA_PREFIX=/usr/local/anaconda3
CONDA_PROMPT_MODIFIER=(base)
CONDA_PYTHON_EXE=/usr/local/anaconda3/bin/python
CONDA_ROOT=/usr/local/anaconda3
CONDA_SHLVL=1
PATH=/usr/local/anaconda3/bin:/usr/local/anaconda3/condabin:/usr/local/bin:
/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/anaconda3/bin
REQUESTS_CA_BUNDLE=<not set>
SSL_CERT_FILE=<not set>

active environment : base
active env location : /usr/local/anaconda3
shell level : 1
user config file : /Users/RossRoberts/.condarc
populated config files : /Users/RossRoberts/.condarc
conda version : 4.8.0
conda-build version : 3.18.8
python version : 3.7.3.final.0
virtual packages : __osx=10.14.6
base environment : /usr/local/anaconda3 (writable)
channel URLs : https://conda.anaconda.org/conda-forge/osx-64
https://conda.anaconda.org/conda-forge/noarch
https://repo.anaconda.com/pkgs/main/osx-64
https://repo.anaconda.com/pkgs/main/noarch
https://repo.anaconda.com/pkgs/r/osx-64
https://repo.anaconda.com/pkgs/r/noarch
package cache : /usr/local/anaconda3/pkgs
/Users/RossRoberts/.conda/pkgs
envs directories : /usr/local/anaconda3/envs
/Users/RossRoberts/.conda/envs
platform : osx-64
user-agent : conda/4.8.0 requests/2.22.0 CPython/3.7.3 Darwin/18.7.0 OSX/10.14.6
UID:GID : 502:20
netrc file : None
offline mode : False


An unexpected error has occurred. Conda has prepared the above report.

我已经运行了 conda init fish并重新启动了我的 shell ,甚至尝试重新启动机器,但我仍然收到相同的错误。

这个问题阻止我运行代码,因为我的项目解释器被配置为这个环境,但任何时候我尝试安装它安装到事件环境(基础)的包。

最佳答案

我有同样的问题。请注意 /usr/local/anaconda3/bin 在您的 上路径 两次。确保您自己没有将该目录放在您的路径上。
conda init fish在您的鱼配置中添加一行,该行将创建一个“conda”shell 函数,并附加 /usr/local/anaconda3/bin 给您的 路径 ,您正在干扰 conda init 的某些假设使。

关于python - 无法激活现有的 conda 环境,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59510865/

38 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com