Pip安装包报编译错误,可以降低版本试试

1、新建虚拟环境的时候,用python=3.9的版本

conda create -n mypycommon python=3.9
conda activate mypycommon

2、对于要安装的库,先尝试最新版本不行就降版本

如下命令,安装最新版本

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple openai

这时候如果报错,就先看下有哪些可用的版本,方法是openai=xxxx,随便写个乱七八糟的数字

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple openai==xxxxxxx

这个时候命令行会打印可用的版本列表

file

我们看到,最新版本是1.2.3
那么我们可以降低版本,挨个尝试

比如尝试1.2.1的版本,在install的时候,指定openai==1.2.1即可

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple openai==1.2.1

Leave a Comment