如何在 Anaconda 中将 Python 从 3.7 降级到 3.5

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/53972362/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 20:24:42  来源:igfitidea点击:

How to downgrade Python from 3.7 to 3.5 in Anaconda

pythontensorflowanaconda

提问by Anonymous

I've been trying to downgrade the version of Python in Anaconda as it doesn't support TensorFlow and I get the following error(s):

我一直在尝试降级 Anaconda 中的 Python 版本,因为它不支持 TensorFlow,并且出现以下错误:

screenshot of the error

错误截图

回答by guru

You can create a new environment for your experiments:

您可以为您的实验创建一个新环境:

conda create -n new_environment python=3.5

Or install anaconda with another python version (http://docs.anaconda.com/anaconda/user-guide/faq/#how-do-i-get-the-latest-anaconda-with-python-3-5)

或者使用另一个 python 版本安装 anaconda ( http://docs.anaconda.com/anaconda/user-guide/faq/#how-do-i-get-the-latest-anaconda-with-python-3-5)

回答by David Deprost

From your error output it is clear there is a dependency conflict:
backports.os requires python 2.7.

从您的错误输出中可以明显看出存在依赖冲突
backports.os 需要 python 2.7。

Simply uninstall backports.os like this: conda uninstall backports.os
And then downgrade Python: conda install python=3.5

只需像这样卸载 backports.os: conda uninstall backports.os
然后降级 Python: conda install python=3.5

The fact that you're on Python 3.7, but backports.os is still requiring Python 2.7 is proof something has gone wrong with your setup. If you still require backports.os, simply reinstall it when Python is downgraded: conda install backports.os.

您使用的是 Python 3.7,但 backports.os 仍然需要 Python 2.7,这一事实证明您的设置出现了问题。如果您仍然需要backports.os,只需重新安装它时,Python是降级:conda install backports.os

回答by fuwiak

Try virtualenv:

尝试虚拟环境:

[sudo] pip install virtualenv

After installation:

安装后:

python3 -m venv /path/to/new/virtual/environment

Run

source my_project/bin/activate