Building Blender with a different Python version
If you build Blender for development or street cred, you know how system updates can be a problem sometimes.
I hit this a while ago when Arch updated to Python 3.5 as soon as it came out. I asked around on #blendercoders without hoping much, but turns out you can actually build Blender with Py 3.5. Even 3.6!
Delete all variables starting with “PYTHON_” in CMakeCache.txt (hint: it’s in your build folder). Then run the following command to regenerate the CMake cache with the right Python.
cmake -DPYTHON_VERSION=3.5 ../blender
Remember to change it to the Python version in your system. Also, make sure to point the last argument to the directory where you keep Blender’s source.
Now you can do
make as usual. If you want to make a debug build you can add this to the previous command:
Hope you found this useful too, thanks go to Campbell for helping me out with this.
I had no cmakecache.txt in my blender folder.
Hi! cmakecache.txt is created when running cmake. If you haven’t run cmake yet there won’t be a cache file, so you can skip that step.
Thanks! This was very helpful.
I couldn’t get Blender to compile because the latest pull from the repository brought a new Python version, but of course the variables in my CMakeCache.txt were still set to the old version.
I simply changed all of the version numbers to the correct one and Blender compiled successfully.
Hey, glad it was useful!