Last Updated on 2023年9月17日 by go123
当你在 Code Interpreter 的虚拟环境中发现缺少某些库,而该环境又无法直接访问外部网络进行安装时,你可以选择离线安装的方法。以下提供了两种离线安装的方式:
Table of Contents
安装单个库
- 首先,访问PyPI官方网站
- 搜索并找到你需要的库,并下载对应的
.whl
文件。 - 将下载的
.whl
文件上传到Code Interpreter。 - 在Code Interpreter中,用GPT4生成安装指令。

打包并上传所有依赖
- 使用
pip freeze > requirements.txt
来创建一个依赖列表。 pip download -r requirements.txt --dest ./libs/
,需要的文件就都在这个文件夹里了。- 把libs打包,上传到Code Interpreter让gpt4解压并安装依赖。
发表回复