在代码运行过程中遇到ModuleNotFoundError: No module named 'onnxruntime,然后安装onnxruntime,在命令行运行**conda install -c conda-forge onnxruntime **,报以下错误
Collecting package metadata (current_repodata.json): failed
CondaHTTPError: HTTP 429 TOO MANY REQUESTS for url <https://mirrors.ustc.edu.cn/anaconda/pkgs/main/win-64/current_repodata.json>
Elapsed: 00:46.975976
An HTTP error occurred when trying to retrieve this URL.
HTTP errors are often intermittent, and a simple retry will get you on your way.
'https//mirrors.ustc.edu.cn/anaconda/pkgs/main/win-64'
换镜像地址也没有得到解决,然后发现不止安装onnxruntime会报这个错误,安装别的模块如numpy也会报这个错误
后来找到一个方法成功了,步骤如下:
一、把路径“Anaconda3/Library/bin ”如下两个文件复制到“Anaconda3/DLLs”:
libcrypto-1_1-x64.dll
libssl-1_1-x64.dll
二、在命令行运行命令清除缓存
conda clean -i
三、找到C:\Users\Administrator\.condarc 这个文件,如果没有,试试自行创建,运行
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --show-sources
四、 编辑找到的.condarc文件,拷贝如下内容并覆盖原本的内容:
channels:
- defaults
show_channel_urls: true
channel_alias: http://mirrors.tuna.tsinghua.edu.cn/anaconda
default_channels:
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/pro
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
conda-forge: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
msys2: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
bioconda: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
menpo: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
simpleitk: http://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
五、在运行conda update命令试试看,会看到
Collecting package metadata (current_repodata.json): done
Solving environment: |
六、重新运行命令
conda install -c conda-forge onnxruntime
会看到
Collecting package metadata (current_repodata.json): done
Solving environment: -
安装成功
参考链接: 【综合解决方案】Anaconda: Collecting package metadata (current_repodata.json): failed