第一次在mac上安裝tensorflow
因?yàn)殡娔X安裝的anaconda是python3.9版本答憔,下意識(shí)的安裝tensor flow的定義python版本就下了3.9(這里有一個(gè)坑)
##終端命令
conda create -n tensorflow python=3.9
看似一帆風(fēng)順的安裝界面
第二步激活tensor flow環(huán)境
#終端命令
conda activate tensorflow
第三步安裝tensor flow (問題來(lái)了)
#安裝命令
conda install tensorflow
報(bào)錯(cuò)如下,大概是說(shuō)不支持python版本3.9夺颤,支持的版本包括2.7,3.7洛波,3.6全肮,3.5
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Solving environment: \
Found conflicts! Looking for incompatible packages.
This can take several minutes. Press CTRL-C to abort.
failed
UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:
Specifications:
- tensorflow -> python[version='2.7.*|3.7.*|3.6.*|3.5.*']
Your python: python=3.9
If python is on the left-most side of the chain, that's the version you've asked for.
When python appears to the right, that indicates that the thing on the left is somehow
not available for the python version you are constrained to. Note that conda will not
change your python version to a different minor version unless you explicitly specify
that.
第四步塞蹭,將python版本降級(jí),我是從3.9改成了3.6
#命令
conda install python=3.6
第五步门坷,再來(lái)一次安裝
conda install tensorflow
安裝成功宣鄙,但是真的好慢
第六步,檢查一下
成功加載~
相比較網(wǎng)上的其他教程默蚌,這個(gè)安裝方法親測(cè)有效冻晤,且比較簡(jiǎn)單,只需要4步绸吸。