20201028のTensorFlowに関する記事は1件です。

【Python】Tensorflow2.0がPython3.8に対応していなかったのでPythonをダウングレードした話

環境

Mac OS Catalina 10.15.7
Spyder 4.1.4
Anaconda 3
Python 3.8.3

やったこと

TerminalでTensorflowをインストールしようとすると、下記のようなエラーが出ました。(2020/10/28現在)

(省略)
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.8

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.
(省略)

TensorflowのサポートしているPythonのバージョンは3.7までだけど、あなたのは3.8ですよ。と教えてくれています。

というわけでこちらの記事を参考にさせていただきながら、Python3.7の仮想環境を作りました。
[環境構築 Python]

Anaconda NavigaterのEnviromentsにあるCreateボタンを押し、
 Name:python37
 Package:python3.7
で作成完了。
▶︎ボタンを押してTerminalを起動し、condaを更新

# condaの更新
conda update --all
conda update -n base conda

そしてtensorflowをインストール

conda install tensorflow

ちなみに、condaとpipを混同するのはあまり素敵じゃないようです。
[condaとpip:混ぜるな危険]

Spyderを起動して下記を入力して実行。無事importできました。

import tensorflow
  • このエントリーをはてなブックマークに追加
  • Qiitaで続きを読む