简体   繁体   English

为什么conda切换环境后python版本没有切换?

[英]Why did the python version not switch after conda switched the environment?

python3.7.12 should be the python version of the hsm environment python3.7.12应该是hsm环境的python版本

(hsm) leelee@ubuntu-PowerEdge-T440:~/tools/hsm-master/predict$ which python
/home/leelee/miniconda3/envs/hsm/bin/python
(hsm) leelee@ubuntu-PowerEdge-T440:~/tools/hsm-master/predict$ /home/leelee/miniconda3/envs/hsm/bin/python
Python 3.7.12 | packaged by conda-forge | (default, Oct 26 2021, 06:08:21) 
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> quit()

But if I type python directly, it will return a 3.9.5 python version但是如果我直接输入python ,它会返回一个3.9.5的python版本

(hsm) leelee@ubuntu-PowerEdge-T440:~/tools/hsm-master/predict$ python
Python 3.9.5 (default, Jun  4 2021, 12:28:51) 
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> quit()

I guess when I type python , I entered /home/leelee/miniconda3/bin/python我猜当我输入python ,我输入了/home/leelee/miniconda3/bin/python

(hsm) leelee@ubuntu-PowerEdge-T440:~/tools/hsm-master/predict$ which -a python
/home/leelee/miniconda3/envs/hsm/bin/python
/home/leelee/miniconda3/bin/python
(hsm) leelee@ubuntu-PowerEdge-T440:~/tools/hsm-master/predict$ /home/leelee/miniconda3/bin/python
Python 3.9.5 (default, Jun  4 2021, 12:28:51) 
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> quit()

Why does this happen and how can I solve it?为什么会发生这种情况,我该如何解决?

Looks like you added Python to the system PATH, which is not recommended when using conda.看起来你在系统PATH中添加了Python,在使用conda时不推荐这样做。 Simply check your PATH after conda activation and have a look at the sequence of the Python folders.只需在 conda 激活后检查您的 PATH 并查看 Python 文件夹的顺序。

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

相关问题 为什么Conda在激活环境后无法调用正确的Python版本? - Why Conda cannot call correct Python version after activating the environment? 如何创建具有特定 python 版本的 conda 环境? - How to create conda environment with specific python version? conda无法创建不同的Python版本环境 - Conda unable to create different Python version environment 如何在conda中更新root环境中的Python版本 - How to update Python version in root environment in conda conda 环境使用/调用不正确的 python 版本 - conda environment using/calling incorrect python version 为什么我在创建新的 conda 环境时必须指定 python 版本? - Why do I have to specify the python version when creating a new conda environment? 创建 conda 环境后找不到命令“python” - Command 'python' not found after creating conda environment 为什么我在激活 Python 3 Conda 环境后卡在系统默认的 Python 2 解释器上? - Why am I stuck with the system default Python 2 interpreter after activating a Python 3 Conda environment? 为什么conda在激活另一个环境后重新定义基本环境? - Why conda redefines base environment after activation of another environment? 为什么即使在 pip 将它安装到 Python conda 环境中之后也找不到模块“ultralytics”? - Why is the module 'ultralytics' not found even after pip installing it in the Python conda environment?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM