简体   繁体   English

如何使用 Anaconda 升级到 Python 3.8?

[英]How do I upgrade to Python 3.8 with Anaconda?

I recently installed Python 3.8 onto my computer.我最近在我的电脑上安装了 Python 3.8。 I now have Python 3.7 and 3.8.我现在有 Python 3.7 和 3.8。 I would like to delete 3.7 but I don't want to mess anything up.我想删除 3.7 但我不想搞砸任何事情。

When I type 'python --version' in the Anaconda Prompt,当我在 Anaconda Prompt 中输入“python --version”时,

Python 3.7.9蟒蛇 3.7.9

I fear that if I uninstall 3.7, all the libraries in Anaconda will not work.我担心如果我卸载 3.7,Anaconda 中的所有库都将无法运行。 How do I uninstall 3.7 and make sure that Anaconda "links up" with 3.8?如何卸载 3.7 并确保 Anaconda 与 3.8“链接”?

UPDATE: I've since figured this out... I originally tried to install with 'conda update python' ... this does not achieve the update.更新:我已经想通了......我最初尝试使用'conda update python'进行安装......这并没有实现更新。 I then downloaded 3.8 from Python's website.然后我从 Python 的网站下载了 3.8。 This seemed to mess up things.这似乎把事情搞砸了。 I then uninstalled all of Anaconda and then reinstalled it.然后我卸载了所有的 Anaconda,然后重新安装了它。 By re-installing, Python 3.8 was installed and is working.通过重新安装,Python 3.8 已安装并正在运行。 For future updates, I am still not sure what the best way to update from 3.x to 3.y is as suggestions on other message boards did not seem to work.对于未来的更新,我仍然不确定从 3.x 更新到 3.y 的最佳方式是什么,因为其他留言板上的建议似乎不起作用。

Thank you for sharing this.感谢您分享这个。 I literally just spent a day trying to update python version using conda but it goes into a seemingly endless loop of resolving conflicts.我真的花了一天时间尝试使用 conda 更新 python 版本,但它进入了解决冲突的看似无休止的循环。 I also tried to install 3.8 directly but that did not work.我也尝试过直接安装 3.8 但这没有用。 The solution really was to just download and install the latest version of Anaconda.解决方案实际上是下载并安装最新版本的 Anaconda。

I try to give you a comprehensive solution If you want to update without removing you just need to switch the python3 to python3.8.我试着给你一个全面的解决方案如果你想更新而不删除你只需要将python3切换到python3.8。 The way install python3.8 will be executed through ppa. install python3.8的方式会通过ppa执行。 Then you can switch between version of python然后你可以在python版本之间切换

sudo rm /usr/bin/python3 
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 3
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.7 2
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1

Choose python3 link with python3.8, then pip3 will point to python3.8选择python3与python3.8链接,那么pip3就会指向python3.8

But if you remove python 3.7, you need to self configure pip again to have it point to an exact python version by但是如果你删除 python 3.7,你需要再次自我配置 pip 让它指向一个确切的 python 版本

wget https://bootstrap.pypa.io/get-pip.py
python3 get-pip.py  #which has been linked to 3.8

However, this processed is simple for virtual environment, you just need to config your own package of python by yourself choosing.但是,这个处理对于虚拟环境来说很简单,你只需要自己选择配置自己的python包。 You can install any environment by creating a new environment.您可以通过创建新环境来安装任何环境。 Your python3.7 will be a base environment,你的python3.7将是一个基础环境,

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM