I need a module call
but blender does not have it !
now I already have python 3.4 installed on my system
where can I install this new module and how to use it in blender ?
this seems to come as an egg file
what do you do with that ?
thanks
I need a module call
but blender does not have it !
now I already have python 3.4 installed on my system
where can I install this new module and how to use it in blender ?
this seems to come as an egg file
what do you do with that ?
thanks
Do you have âpipâ installed? If so you can grab it and put it into the same directory as your .blend file or into your âaddonâ directory. There is lots of documentation around for where to install modules so that Blenderâs python can pick them up.
pip install --target <directory_for_module> <pytz_URL>
For example:
pip install --target /usr/tmp <pytz_URL>
Would create a directory called â/usr/tmp/pytzâ
I got it for ipython
but wondering if necessary to install it in blender
anyway to import it from the 3.4 python on my system instead ?
if possible donât wont to have to re instal it each time we change over build
or running it from a local build !
there is a way to add a new path in a script
but can it be use for importing a module from python system?
thanks
There are ways to do it. You should read up on how Python searches for modules https://docs.python.org/2/tutorial/modules.html#the-module-search-path.
Blender has some more complexities with how it interact with Python because it bundles a copy of Python with Blender instead of using an existing Python install on the system. I have always put my modules next the the .blend file that needed them so Iâve never really looked deeply into how to control the module search path.
My gut says that getting Blender to pull in modules from a system Python install will require some work-arounds.
This works for me:
import sys
sys.path.append("E:\Python34\Lib\site-packages")
import __yourmodule__
Replace the directory path to wherever your python installation is. I think this is more portable than copying the module into blenderâs python directory, since you can run it from any blender version and the same code will work.
I have my own scripts folder (next to my art, in version control) that contains my plugins.
In user preferences i have pointed blender to that folder as scripts folder.
Hereâs my setup:
scripts/
- modules/
- mysql
- other modules
- addons/
- addon1
- addon2...
From my addons I can now just import mysql and the other modules I have in âmodulesâ
derGoldstein, Iâm a newbie trying to import some python modules. Iâm on my 3rd day. I had high hopes for your solution.
My python is âC:\Python34â and Iâve installed PIL.
From pyCharm the code
from PIL import Image #works great
inside Blender
import sys
sys.path.append(âC:\Python34\Lib\site-packagesâ)
from PIL import Image
gets the error:
File âC:\Python34\Lib\site-packages\PIL\Image.pyâ, line 63, in <module>
from PIL import _imaging as core
ImportError: DLL load failed: %1 is not a valid Win32 application.
You had said âReplace the directory path to wherever your python installation is.â How would I do that?
and might that fix my problem?
thanks - kurt
kklinzing:
I can think of two things:
In case anyone is wondering: Youâre not supposed to use the discontinued PIL, and rather the âPillowâ library which is a compatible replacement, licensed more flexible and still maintained!
Itâs also a great candidate for inclusion in the standard blender distributions for obvious reasons.