gpt4 book ai didi

python - 如何升级到 Google-Colab 'permanent' 中的 python 包?

转载 作者:行者123 更新时间:2023-12-05 03:29:43 30 4
gpt4 key购买 nike

我一直在为某个数据科学项目制作笔记本,但在导入更新包时遇到了这个问题。我正在使用 matplotlib 绘图。每次我打开笔记本时,Google Colab 都会导入版本 3.2.2。

import matplotlib
matplotlib.__version__ ## returns 3.2.2

显然,我尝试使用 !pip install matplotlib --upgrade 更新包,这工作正常。重新启动运行时后,我现在有了更新版本的 matplotlib (3.5.1)。但是每当 session 终止时,我在使用的绘图上再次出现错误,因为 matplotlib 的版本已恢复为 2.2.2。我尝试按照此 StackOverflow question 中的建议使用 !pip3 ,但我仍然遇到同样的问题。如何永久升级 Google Colab 中的软件包?

最佳答案

几经搜索,默认情况下似乎没有办法做到这一点。正如来自 FAQs 的解释谷歌合作实验室:

Code is executed in a virtual machine private to your account. Virtualmachines are deleted when idle for a while, and have a maximumlifetime enforced by the Colab service.

article但是,值得一试。我现在会继续安装。

关于python - 如何升级到 Google-Colab 'permanent' 中的 python 包?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70966105/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com