简体   繁体   English

如何在我的环境中设置与基本环境不同的 Python 版本?

[英]How do I set a different Python version in my environment from my base environment?

My base environment's Python version is the 3.7, the way I like it.我的基础环境的 Python 版本是 3.7,我喜欢它。 However, I need to create a new environment that uses Python version 3.5.但是,我需要创建一个使用 Python 版本 3.5 的新环境。

I created my environment specifying version 3.5:我创建了指定版本 3.5 的环境:
conda create --name dbconnect python=3.5

However, when I activate my environment ( conda activate dbconnect ) and check for the python version ( python --version ), I get但是,当我激活我的环境( conda activate dbconnect )并检查 python 版本( python --version )时,我得到

(dbconnect) computer-name:src vivian$ python --version
Python 3.7.3

I tried downgrading the Python version in the dbconnect environment by running conda install python=3.5 and get this我尝试通过运行conda install python=3.5dbconnect环境中降级 Python 版本并得到这个

(dbconnect) computer-name:src vivian$ conda install python=3.5
Collecting package metadata (current_repodata.json): done
Solving environment: done

# All requested packages already installed.

It appears to have worked but it hasn't because when I check the Python version, it is still 3.7.3它似乎有效,但没有,因为当我检查 Python 版本时,它仍然是 3.7.3

(dbconnect) computer-name:src vivian$ python --version
Python 3.7.3

The only way to have my dbconnect environment have Python version 3.5 is to downgrade the Python version in my base environment, but I do not want to do that.让我的dbconnect环境具有 Python 版本 3.5 的唯一方法是在我的基本环境中降级 Python 版本,但我不想这样做。 How do I have my dbconnect environment use Python 3.5 and my base environment use Python 3.7?如何让我的dbconnect环境使用 Python 3.5 而我的基础环境使用 Python 3.7?

Sharing the answer as per the comment by the original poster:根据原始发布者的评论分享答案:

"I figured it out. My environment variables were getting messed up because my. bash_profile was bad". “我想通了。我的环境变量搞砸了,因为我的bash_profile很糟糕”。

暂无
暂无

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

相关问题 如何更新我的 python 环境,我的 python 设置是一团糟,我以许多不同的方式安装它 - How to do I update my python environment, my python setup is a mess and I installed it in many different ways 如何将我的 conda 基础环境从 Python 3.7 更改为 3.9? - How to change my conda base environment from Python 3.7 to 3.9? 为什么我在笔记本中使用的 tensorflow 版本与我在环境中使用的版本不同? - Why is the tensorflow version I use in my notebook different from the version I use in my environment? 我是否需要在 conda 基础环境中更新/升级 Python 版本? - Do I need to update/upgrade Python version at conda base environment? 如何创建python环境以通过我的应用进行分发? - How do I create a python environment for distribution with my app? 如何从不同的 repo 激活 python 虚拟环境? - How do I activate python virtual environment from a different repo? 如何在虚拟环境中使用不同的 python3.x 版本的 python - How do I use a different python3.x version of python inside virtual environment 我想在我的第一个python环境中从第二个python环境调用函数。 这可能吗? - I want to call functions from second python environment in my my first python environment. Is this possible? 如何让我的 conda 环境识别我的 GPU? - How do I get my conda environment to recognize my GPU? 加载环境var时,如何以cron身份运行python命令? - How do I run my python command as a cron while loading my environment vars?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM