Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mkdir ~/.config/blender/2.79/scripts/modules
- pip install -t ~/.config/blender/2.79/scripts/modules <python-package>
- def fix_path():
- """Enable 3rd party Python modules installed in an
- active Virtualenv when Python is run.
- (Blender ignores the virtualenv, and uses a
- Python binary hardcoded in the build. This works
- if the virtualenv's Python is the same as blenders')
- """
- import sys, os
- from pathlib import Path
- pyversion_path = f"python{sys.version_info.major}.{sys.version_info.minor}"
- for pathcomp in os.environ["PATH"].split(os.pathsep)[::-1]:
- p = Path(pathcomp)
- if p.name != "bin":
- continue
- lib_path = p.parent / "lib" / pyversion_path / "site-packages"
- if not lib_path.exists():
- continue
- if str(lib_path) in sys.path:
- continue
- sys.path.insert(0, str(lib_path))
- print(f"{__name__} Add-on: prepended {lib_path!r} to PYTHONPATH")
- fix_path()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement