Blender and conda

烂漫一生 提交于 2020-06-13 08:21:51

问题


I have installed Blender recently, and want to script with my conda libraries (Miniconda python 2.7) but conflicts occur due to Blender 2.77, and imports are not reachable. How to make this work?


回答1:


Since v2.50 blender has used python 3.x. You should start by using the python3 version of miniconda to be able to use it within blender. For blender 2.77 python 3.5 is being used.

You have several options for adding custom python modules to blender.

  1. Include all modules within the one folder for your addon. (an addon is a python module)
  2. Configure the scripts directory in blender's preferences.
  3. Install your module within blender's python directories. This explains the file paths blender uses.
  4. Delete the bundled python (or build your own blender) so that blender uses a system installed python. Ensure that the system install matches the python version that blender was built with.

There are some environment variables you can set to help blender find what it needs. Python's sys.path may also be altered to include your modules.

Which approach you use will mostly depend on what you plan to do. The first would be best if you want to share your work with others, while the others would be better suited if you only want to adjust your install of blender.

You might find this answer at blender.stackexchange.com can help.

If you have strong reasons for using the python 2.7 version of miniconda then you will need to look at other ways to transfer data, like using subprocess.check_call() or multiprocess.Pipe. You should read this if you need to go that way.



来源:https://stackoverflow.com/questions/37254523/blender-and-conda

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!