All the ways to import Python libraries into your Blender scripts

When we code a blender script sometimes we need to use some other python libraries.

Standard Solution

The standard solution is to include into your script code the library code.

An easy workaround is to use virtualenv

python3.7 -m venv external_libraries
source venv/bin/activate
pip install -r requirements.txt

From the Blender script we can find the coode of the library at external_libraries/lib_bame/…

Global solution

Sometimes we use some library every day and we want that this library are in every project. The solution is to add this libraries directly to blender.

cd ....//home/mint/blender-2.83.1-linux64/2.83/python/bin
./python3.7m -m ensurepip
./python3.7m -m pip install your_libraries

Conclusion

To release an addon obviously the first solution is the best one, because we cannot ask to the user to install library inside blender, and different plugin can have different version of the same library, so it can be a problem.

But if we use very offen plugin with some library for experimental reason or we develop every day may be it can be a great solution to be more efficient in particular for learn.

--

--

--

Linux user and Open Source fun. Deep learning PhD Student, Full stack web developer, Mobile developer, Musitian.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

IPC Technique — PIPE

Sprint Planning

zenity — How to use Zenity with Different options.

How to use AWS EFS Service with 2 instence....

5 Preferred Programming Languages for Game Development

Protofuze Invite Contest

Containerization |Part 2: From LXD to Kubernetes

I’m Sujith Simha as a part of my learning I made a chat bot using python and deployed it using…

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Nicola Landro

Nicola Landro

Linux user and Open Source fun. Deep learning PhD Student, Full stack web developer, Mobile developer, Musitian.

More from Medium

Webscraping

Finger Controls, Screen Brightness

How to control RGB LED using Arduino Uno

How to control RGB LED using Arduino Uno

An Alternative Introduction to Altair Plotting