-
Notifications
You must be signed in to change notification settings - Fork 0
/
pip-blender-python.html
169 lines (161 loc) · 7.6 KB
/
pip-blender-python.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Installing pip for Python in Blender — A Place for Asides</title>
<meta name="description" content="Title: Installing pip for Python in Blender; Date: 2018-09-30; Author: Peter Mortimer">
<meta name="author" content="Peter">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
<!--[if lt IE 9]>
<script src="./theme/html5.js"></script>
<![endif]-->
<link href="./theme/css/ipython.css" rel="stylesheet">
<link href="./theme/css/jquery.tocify.css" rel="stylesheet">
<link href="./theme/css/lightbox.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css" rel="stylesheet">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.1.0/css/font-awesome.min.css" rel="stylesheet">
<!--
<link href="https://stackpath.bootstrapcdn.com/bootswatch/4.3.1/minty/bootstrap.min.css" rel="stylesheet">
-->
<link href="./theme/css/local.css" rel="stylesheet">
<link href="./theme/css/pygments.css" rel="stylesheet">
</head>
<body>
<div class="container main">
<div class="page-header">
<div class="row">
<div class="col-8 col-sm-8">
<h1><a href="./">A Place for Asides</a>
<br> </div>
<div class="col-4 col-sm-4 page-header-links">
<p><a href="/pages/about.html">About</a> | <a href="/pages/publications.html">Publications</a> | <a href="/pages/previous-projects.html">Previous Projects</a> | <a href="/blog/index.html">Blog</a> | <a href="/pages/books.html">Book List</a> </p>
</div>
</div>
</div>
<div class="row">
<div class="col-md-8 col-md-offset-2">
<div class="article" itemscope itemtype="http://schema.org/BlogPosting">
<div class="text-center article-header">
<h1 itemprop="name headline" class="article-title">Installing pip for Python in Blender</h1>
<span itemprop="author" itemscope itemtype="http://schema.org/Person">
<h4 itemprop="name">Peter Mortimer</h4>
</span>
<time datetime="2018-09-30T18:05:00+02:00" itemprop="datePublished">September 30 2018</time>
</div>
<div itemprop="articleBody" class="article-body"><p>If you are working on a Computer Vision project in Python that requires 3D scene renderings, then <a href="https://www.blender.org/">Blender</a> is the way to go. Blender comes bundled with its own Python version, which can be used to write Python scripts for Blender. This is useful for automating rendering jobs, since Python in Blender provides you the <strong>bpy</strong> module, which gives you access to Blender data, classes, and functions. </p>
<p>Unfortunately, the Python in Blender does not share libraries with your system's Python. But if you don't want to be limited to the Python Standard Library available for Python in Blender, then you can install pip for Python in Blender.</p>
<p>The blender Python binaries are here in the blender directory:</p>
<div class="highlight"><pre><span></span>/your-blender-path/2.xx/python/bin/python.exe
</pre></div>
<p>Use this python binary to run the <a href="https://bootstrap.pypa.io/get-pip.py">get-pip.py</a> script from the <a href="https://pip.pypa.io/en/stable/installing/">pip documentation</a> to install pip for Python in Blender. Don't forget to point explicitly to the python binary from your blender version. The installation command will look something like this:</p>
<div class="highlight"><pre><span></span>/your-blender-path/2.xx/python/bin/python.exe /Downloads/get-pip.py
</pre></div>
<p>I ran the installation on Windows, which required me to open a Terminal with admin priviliges to execute the <strong>pip.exe</strong>. Use this version of pip from Python in Blender (not the pip from your system's Python) to install 3rd party modules for Blender in Python: </p>
<div class="highlight"><pre><span></span>/your-blender-path/2.xx/python.exe pip install module
</pre></div>
<p>This should allow you to install 3rd party modules for your scripts in Python in Blender.</p>
<h2>References</h2>
<p>Read these StackExchange questions for more information on installing pip for Python in Blender. My post is based on their answers:</p>
<ul>
<li><a href="https://blender.stackexchange.com/questions/5596/advantages-of-using-python-in-blender-for-animation">Advantages of using Python in Blender for Animation?</a></li>
<li><a href="https://blender.stackexchange.com/questions/1365/how-can-i-run-blender-from-command-line-or-a-python-script-without-opening-a-gui">How can I run blender from command line or a python script without opening a GUI?</a></li>
<li><a href="https://blender.stackexchange.com/questions/56011/how-to-use-pip-with-blenders-bundled-python">How to use PIP with Blender's bundled Python?</a></li>
</ul></div>
<hr>
<div>
Category:
<span itemprop="articleSection">
<a href="./category/python.html" rel="category">Python</a>
</span>
</div>
<div>
Tags:
<span itemprop="keywords">
<a href="./tag/blender.html" rel="tag">Blender</a>
</span>
<span itemprop="keywords">
<a href="./tag/pip.html" rel="tag">pip</a>
</span>
</div>
</div>
</div>
</div> <!-- <hr> -->
</div> <!-- /container -->
<footer class="aw-footer bg-danger">
<div class="container"> <!-- footer -->
<div class="row">
<div class="col-md-10 col-md-offset-1">
<div class="row">
<div class="col-md-3">
<h4>Navigation</h4>
<ul class="list-unstyled my-list-style">
<li><a href=".">A Place for Asides</a></li>
<li><a href="./pages/about.html"><i class="fa fa-About "></i> About</a></li>
<li><a href="./pages/blogroll.html"><i class="fa fa-Blogroll "></i> Blogroll</a></li>
<li><a href="./pages/books.html"><i class="fa fa-Books I've Read "></i> Books I've Read</a></li>
<li><a href="./pages/previous-projects.html"><i class="fa fa-Previous Projects "></i> Previous Projects</a></li>
<li><a href="./pages/publications.html"><i class="fa fa-Publications "></i> Publications</a></li>
</ul>
</div>
<div class="col-md-3">
<h4>Author</h4>
<ul class="list-unstyled my-list-style">
<li><a href="https://github.com/tonyromarock">GitHub</a></li>
</ul>
</div>
<div class="col-md-3">
<h4>Categories</h4>
<ul class="list-unstyled my-list-style">
<li><a href="./category/linux.html">Linux (1)</a></li>
<li><a href="./category/nonfiction.html">Nonfiction (1)</a></li>
<li><a href="./category/python.html">Python (3)</a></li>
</ul>
</div>
</div>
</div>
</div>
</div>
</footer>
<div class="container bottom">
<div class="row">
<div class="col-md-12 text-center center-block aw-bottom">
<p>© Peter 2020</p>
<p>Powered by Pelican</p>
</div>
</div>
</div>
<!-- JavaScript -->
<script src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="./theme/js/jquery-ui-1.9.1.custom.min.js"></script>
<script src="./theme/js/jquery.tocify.min.js"></script>
<script src="./theme/js/lightbox.js"></script>
<script src="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script type="text/javascript">
jQuery(document).ready(function($) {
$("div.collapseheader").click(function () {
$header = $(this).children("span").first();
$codearea = $(this).children(".input_area");
$codearea.slideToggle(500, function () {
$header.text(function () {
return $codearea.is(":visible") ? "Collapse Code" : "Expand Code";
});
});
});
});
$(function() {
var toc = $("#toc").tocify({
context:"div.article-body",
selectors:"h1,h3",
showAndHide:"false",
extendPage:"false",
history:"true",
scrollHistory:"true"
}).data("toc-tocify");
});
lightbox.option({
'wrapAround': true
});
</script>
</body>
</html>