LoginSignup
3
0

More than 3 years have passed since last update.

Blender 2.8.2 で TensorFlow 2.0(CPU) をインストールし、HelloWorld (Windows10)

Last updated at Posted at 2020-05-17

やり方

Blender のデフォルトで Python が入っているので、それに対し pip instlall するだけでいい。
自分の環境では、一種のエラーと一種の警告が出たので、参考としてメモを残す。

最初に、TensorFlow を Blender の Python にインストールする。
Powershell を使う。


# Blender の Python がある場所へ移動
cd 'C:\Program Files\Blender Foundation\Blender 2.82\2.82\python\bin\'

# 念のため、pip をアップグレード
.\python.exe -m pip install --user --upgrade pip

# TensorFlow 2.0 の 2.2.0 をインストール (5分くらい?)
.\python.exe -m pip install tensorflow==2.2.0

# python インタプリンタを起動し、TensorFlow が使えるか確認する
.\python.exe

TensorFlow が入っていることを確認。

.\python.exe -m pip list | Select-String tensor

tensorboard            2.2.1
tensorboard-plugin-wit 1.6.0.post3
tensorflow             2.2.0
tensorflow-estimator   2.2.0

Pythonインタプリンタで TensorFlow のインポート、おそらくエラーが出る。

import tensorflow as tf

エラーが出るとき

以下のエラーが出ると思われる。

ImportError: Could not find the DLL(s) 'msvcp140_1.dll'. TensorFlow requires that these DLLs be installed in a directory that is named in your %PATH% environment variable. You may install these DLLs by downloading "Microsoft C++ Redistributable for Visual Studio 2015, 2017 and 2019" for your platform from this URL: https://support.microsoft.com/help/2977003/the-latest-supported-visual-c-downloads

これは、https://support.microsoft.com/ja-jp/help/2977003/the-latest-supported-visual-c-downloads ここの x64 ダウンロードで解決(場合によりx86)。

参考: https://tialight.com/?p=881

警告が出る

以下のような、GPU が無いという内容

2020-05-17 21:49:28.438207: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found
2020-05-17 21:49:28.443044: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.

今回は CPU なので無視。

Blender の Python コンソールで Hello World

import tensorflow as tf
tf.print("Hello World!")

Window > Toggle System Console からコンソールを確認し、Hello World! が表示されていたら完了。

今回は TensorFlow が Blender で動くか確かめたかったので CPU。
高速実行がしたくなったら GPU の導入についても検討していきたい。

参考資料

3
0
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
3
0