问题
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.
- Include all modules within the one folder for your addon. (an addon is a python module)
- Configure the scripts directory in blender's preferences.
- Install your module within blender's python directories. This explains the file paths blender uses.
- 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