4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

pip install tensorflow==1.x がエラーになるとき

Last updated at Posted at 2020-12-12

pip install tensorflow==1.x ができない

こんなエラーになるとき

python -m pip install tensorflow==1.15
ERROR: Could not find a version that satisfies the requirement tensorflow==1.15 (from versions: 2.2.0rc3, 2.2.0rc4, 2.2.0, 2.2.1, 2.3.0rc0, 2.3.0rc1, 2.3.0rc2, 2.3.0, 2.3.1, 2.4.0rc0, 2.4.0rc1, 2.4.0rc2, 2.4.0rc3, 2.4.0rc4)
ERROR: No matching distribution found for tensorflow==1.15

原因

Pythonのバージョンが合っていないことが原因の可能性が高いです。

例えばPyPIのtensorflow 1.15.4 のページ↓を見ると、tensorflow 1.15.4 が用意しているパッケージはpython 3.5, 3.6, 3.7 用しか提供されていません。
https://pypi.org/project/tensorflow/1.15.4/#files

なので、Python 3.8や3.9でpip installしても対応するパッケージがないので入りません。

解決方法

Pythonのバージョンをpython 3.5, 3.6, 3.7にすればインストールできます。

# バージョン確認
$ python --version
Python 3.7.9

# インストール
$ python -m pip install tensorflow==1.15
///省略

# 確認。モジュールはあることが確認できる
$ python -m tensorflow
/.../bin/python: No module named tensorflow.__main__; 'tensorflow' is a package and cannot be directly executed

参考

4
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?