パープルハット

※当サイトではGoogleアドセンス広告を利用しています

tensorflow インストールエラー(UnsatisfiableError)の解決策

発生した問題

Python=3.11の仮想環境に

conda install tensorflow

でtensorflowのパッケージを追加しようとしたところ、以下のようなエラーが出てしまいました。

UnsatisfiableError: The following specifications were found
to be incompatible with the existing python installation in your environment:

Specifications:

  - tensorflow -> python[version='3.10.*|3.9.*|3.8.*|3.7.*|3.6.*|3.5.*']




解決策

  • エラー文を見る限りどうやらtensorflowはpython3.11に対応していない模様。
  • 3.5~3.10ならOKみたいなので、おとなしくバージョン3.10.6の環境にインストールしてみることに。
  • 仮想環境のPythonのダウングレードは上手いかなかったので(既存パッケージとのconflictが原因かも?)、新しい仮想環境を作りそこにインストールすることにしました。
conda create -n 環境名 python=3.10.6
conda install tensorflow


無事以下のコードを動かせました!!(実行結果:2.10.0)

import tensorflow as tf
print(tf.__version__)