簡體   English   中英

如何在攪拌機中使用 tensorflow?

[英]How to use tensorflow in blender?

我的設置:

攪拌機 2.8.2 Python 3.7.4

我想在攪拌機中實現 tensorflow。 我嘗試使用 pip,但我得到了這些:如何安裝 tensorflow 以在用於攪拌機的 pyhton 腳本中使用它。

 main(["install","tensorflow"])
Collecting tensorflow
  Using cached https://files.pythonhosted.org/packages/5d/6a/9669836f813b73fe5abf5e9f118ccc9b7fb060f02789d385825b0943f9c8/tensorflow-2.3.1-cp37-cp37m-win_amd64.whl
Collecting wheel>=0.26 (from tensorflow)
  Using cached https://files.pythonhosted.org/packages/a7/00/3df031b3ecd5444d572141321537080b40c1c25e1caa3d86cdd12e5e919c/wheel-0.35.1-py2.py3-none-any.whl
Collecting absl-py>=0.7.0 (from tensorflow)
  Using cached https://files.pythonhosted.org/packages/bc/58/0aa6fb779dc69cfc811df3398fcbeaeefbf18561b6e36b185df0782781cc/absl_py-0.11.0-py3-none-any.whl
Collecting opt-einsum>=2.3.2 (from tensorflow)
  Using cached https://files.pythonhosted.org/packages/bc/19/404708a7e54ad2798907210462fd950c3442ea51acc8790f3da48d2bee8b/opt_einsum-3.3.0-py3-none-any.whl
Collecting gast==0.3.3 (from tensorflow)
  Using cached https://files.pythonhosted.org/packages/d6/84/759f5dd23fec8ba71952d97bcc7e2c9d7d63bdc582421f3cd4be845f0c98/gast-0.3.3-py2.py3-none-any.whl
Collecting astunparse==1.6.3 (from tensorflow)
  Using cached https://files.pythonhosted.org/packages/2b/03/13dde6512ad7b4557eb792fbcf0c653af6076b81e5941d36ec61f7ce6028/astunparse-1.6.3-py2.py3-none-any.whl
Requirement already satisfied: numpy<1.19.0,>=1.16.0 in c:\program files\blender foundation\blender 2.82\2.82\python\lib\site-packages (from tensorflow) (1.17.0)
Collecting tensorboard<3,>=2.3.0 (from tensorflow)
  Using cached https://files.pythonhosted.org/packages/02/83/179c8f76e5716030cc3ee9433721161cfcc1d854e9ba20c9205180bb100a/tensorboard-2.4.0-py3-none-any.whl
Collecting tensorflow-estimator<2.4.0,>=2.3.0 (from tensorflow)
  Using cached https://files.pythonhosted.org/packages/e9/ed/5853ec0ae380cba4588eab1524e18ece1583b65f7ae0e97321f5ff9dfd60/tensorflow_estimator-2.3.0-py2.py3-none-any.whl
Collecting termcolor>=1.1.0 (from tensorflow)
  Using cached https://files.pythonhosted.org/packages/8a/48/a76be51647d0eb9f10e2a4511bf3ffb8cc1e6b14e9e4fab46173aa79f981/termcolor-1.1.0.tar.gz
    Complete output from command python setup.py egg_info:
    Read prefs: C:\Users\danny\AppData\Roaming\Blender Foundation\Blender\2.82\config\userpref.blend
    AL lib: (EE) SetChannelMap: Failed to match front-center channel (2) in channel map
    found bundled python: C:\Program Files\Blender Foundation\Blender 2.82\2.82\python
    Warning: class ANIM_OT_set_keyingset contains a property which should be an annotation!
    C:\Program Files\Blender Foundation\Blender 2.82\2.82\scripts\modules\bpy\utils\__init__.py:712
        assign as a type annotation: ANIM_OT_set_keyingset.type
    Warning: class V_OT_set contains a property which should be an annotation!
    C:\Program Files\Blender Foundation\Blender 2.82\2.82\scripts\modules\bpy\utils\__init__.py:712
        assign as a type annotation: V_OT_set.type
    unknown argument, loading as file: -c
Error: Cannot read file 'C:\Users\danny\AppData\Local\Temp\pip-install-jd4_2fc1\termcolor\-c': No such file or directory
    Error: argument has no '.blend' file extension, not using as new file, exiting! C:\Users\danny\AppData\Local\Temp\pip-install-jd4_2fc1\termcolor\-c
    Saved session recovery to 'C:\Users\danny\AppData\Local\Temp\quit.blend'
    Traceback (most recent call last):
      File "C:\Program Files\Blender Foundation\Blender 2.82\2.82\scripts\modules\addon_utils.py", line 351, in enable
        mod = __import__(module_name)
      File "C:\Users\danny\AppData\Roaming\Blender Foundation\Blender\2.82\scripts\addons\verge3d\__init__.py", line 50, in <module>
        from pluginUtils.log import printLog
    ModuleNotFoundError: No module named 'pluginUtils'
    Reloading .babylon exporter
    register_class(...):
    Warning: 'blendi' doesn't contain '_PT_' with prefix & suffix
    register_class(...):
    Warning: 'anime' doesn't contain '_PT_' with prefix & suffix
    register_class(...):
    Warning: 'blendo' doesn't contain '_PT_' with prefix & suffix
    
    Blender quit
    
    ----------------------------------------
1

Command "python setup.py egg_info" failed with error code 1 in C:\Users\<username>\AppData\Local\Temp\pip-install-jd4_2fc1\termcolor\

我已經嘗試更新我的設置工具。 有什么想法我能做什么?

This procedure will upgrade pip and install tensorflow inside the site-packages of Blender's Python (Blender 2.82 has Python 3.7.4).n
這是安裝 tensorflow 的文件夾:

C:\Program Files\Blender Foundation\Blender 2.82\2.82\python\lib\site-packages\

按開始,寫入 cmd 並在命令提示符上按右鍵,選擇“以管理員身份運行”。
要在此區域寫入,您需要管理員權限,這就是您以管理員身份打開終端的原因。

1--> 在 Blender 中升級 pip
如果您在 Blender 安裝過程中沒有更改路徑,那么對於 Blender 2.82 應該是這樣的:

cd "C:\Program Files\Blender Foundation\Blender 2.82\2.82\python\bin"
python -m pip install --upgrade pip
python -m pip install --upgrade tensorflow

你已經完成了。 檢查一切是否正常,從終端啟動 Blender,這樣您就可以在終端中看到 output。
打開攪拌機:

"C:\Program Files\Blender Foundation\Blender 2.82\blender.exe"

一旦 Blender 打開 go 到 Scripting Layout 並創建一個新的文本文件並寫下這個:

import tensorflow as tf
print(tf.reduce_sum(tf.random.normal([1000, 1000])))

第一次導入模塊需要一點時間。 在終端中,最后一行應該是這樣的:

tf.Tensor(970.3253, shape=(), dtype=float32)

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM