conda install python 没有改变 python 版本
我正在尝试将我的 anaconda3 安装的 python 版本从 3.6.15 升级到 3.10。我尝试了 conda install python=3.10
,虽然花了 45 小时来解决冲突,但似乎完成了该过程。但是,当我输入 python --version
时,它似乎仍在 3.6.15
上。我在这里错过了一些基本的东西吗?如何将我的版本升级到 3.10?
I'm trying to updgrade my anaconda3-installed python version from 3.6.15 to 3.10. I tried conda install python=3.10
and although it took 45hrs to resolve conflicts, it seemed to complete the process. However when I type python --version
it appears it's still on 3.6.15
. Am I missing something fundamental here? How do I get my version onto 3.10?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
一般来说,升级环境中Python的版本是有点棘手的。正如您所发现的,有很多依赖关系需要弄清楚,尤其是像 3.6 到 3.10 这样的大步骤。
最简单的方法可能是创建一个新环境,而不是在给定环境中将 Python 从 3.6 升级到 3.10。
这应该可以工作:
这将创建一个名为
myenv
(或您想要的任何名称)的新环境,该环境正在运行 Python 3.10。一旦完成(应该远不到 45 小时!),您可以执行以下操作:现在您可以在 Python 3.10 中安装新库、完成您的工作等。您可以核对其他环境(
conda env remove
)或保留它以备不时之需。如果您询问如何更改您的
基本
环境,我的建议是忽略该环境并使用您自己的环境进行所有操作。如果您询问如何更改 Anaconda 的默认 Python 版本,我认为您必须升级 Anaconda。老实说,如果你的 Anaconda 这么老,我可能还是会这样做。我的方法只是将
~/Anaconda3
吹走并从头开始重新安装,但也许有更聪明的方法来做到这一点。In general, upgrading the version of Python in an environment is a bit tricky. As you found, there are a lot of dependencies to figure out, especially with a big step like 3.6 to 3.10.
Rather than upgrading Python from 3.6 to 3.10 in a given environment, the easiest thing to do is probably to create a new environment.
This should work:
This creates a new environment called
myenv
(or whatever you want), which is running Python 3.10. Once it has finished (it should be much less than 45 hours!), you can do this:Now you can do install new libraries, do your work, etc, in Python 3.10. You can nuke the other environment (
conda env remove
) or keep it in case you need it.If you're asking about changing your
base
environment, my advice is to ignore that environment and use your own environments for everything.If you're asking about changing the default Python version for your Anaconda, I think you have to upgrade Anaconda. To be honest, if your Anaconda is that old, I would probably do that anyway. My approach is just to blow
~/Anaconda3
away and re-install it from scratch, but maybe there's a smarter way to do it.