2017-10-20 180 views
0

我想學習如何從外部python腳本運行blender命令,我正在從GitHub閱讀本教程。然而,當我運行的第一個測試blender -b -P run_script.py我收到以下錯誤信息:從python腳本運行攪拌機

Read new prefs: /home/sim/.config/blender/2.76/config/userpref.blend 

RNA_def_property_ui_text: 'option_extra_vgroups' '' description ends with a '.' ! RNA_def_property_ui_text: 'option_index_type' '' description ends with a '.' ! 

Traceback (most recent call last): File "/home/sim/Desktop/WebApp/Blender/blender-scripting-master/run_script.py", line 22, in <module> 
    exec(compile(open(file).read(), scriptFile, 'exec')) 

    File "fisher_iris_visualization.py", line 3, in <module> 
    import numpy as np ImportError: No module named 'numpy' 

然後攪拌機退出

你有什麼想法解決了嗎? 非常感謝您提前!

+1

攪拌機包括一個解釋器,蟒控制檯和腳本窗口安裝numpy的。 (https://docs.blender.org/manual/en/dev/advanced/scripting/index.html)。我強烈建議您嘗試使用Blender的內部組件,除非您有其他特定用例。 – Rookie

+0

嗨,謝謝你的幫助。整個故事來自於我需要將vtk文件轉換爲服務器後端(如子進程)中的json文件。因此,我想創建一個我可以調用並從遠程運行的腳本。有沒有任何參考鏈接?謝謝 ! – Sim81

回答

1

看起來你沒有在腳本中導入numpy模塊。

這是我的猜測,沒有任何代碼,我不容易調試。

1

我看起來不像你有你的系統上安裝numpy庫。

你可以驗證一下;

python -c 'import numpy; numpy.test()' 

如果錯誤出來,然後用

sudo apt-get install python-numpy 

pip install --user numpy