在anaconda prompt安装tensorflow时,出现以下错误
(base) C:\Users\Eiffel>conda create -name tensorflow python=3.9.6
Collecting package metadata (current_repodata.json): failed
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://mirrors.ustc.edu.cn/anaconda/pkgs/free/win-64/current_repodata.json>
Elapsed: -
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/free/win-64'
网上的方法是清华的镜像用http而不是https等等,但还是没用。
后来试了好久才发现是我架了梯子,后来关掉翻墙软件就好了,但是出现了如下问题:conflicts
网上的解释是
It should also be mentioned that python 3.9 is brand new and it is only the interpreter. For this to be of much use, a whole sub-ecosystem of packages must be built out. Conda-forge are forging ahead with that at present. Until the packages you need are rebuilt against 3.9.0, you will not be able to update to 3.9.0.
链接:https://github.com/conda/conda/issues/10267
我就把python版本改成了3.8,也不行,最后改成3.7就好了
conda create -name tensorflow python=3.7
安装成功
正确方法:使用如下命令
conda install -c conda-forge ipykernel
再使用如下命令(不知道是干嘛的)此处参考的是https://www.coder.work/article/7569604的回答
python -m ipykernel install --user --name vanilla --display-name "Python 3 (vanilla)"
再conda create -name tensorflow python=3.9.6
即可(我的python的版本是3.9.6)
附:另外,增加、删除channel的命令
conda config --add channels ×××(网址)
conda config --remove channels ×××(网址)
查看channel
conda config --show channels