On 25/04/2017 at 06:29, xxxxxxxx wrote:
Hi Thom, sorry for the late reply.
The Windows command-line utility is good enough. I've never used PowerShell, I use Bash from
Git for Windows in a Cmder terminal.
My blog post says "The packages can be installed to your Cinema 4D preferences under
library/python/packages/{os}.". You can open the preferences folder by opening the C4D
preferences (Ctrl+E) and then press the "Open Preferences Folder..." at the bottom.
You should unpack the NumPy binaries into the library/python/packages/win64 direcotry. Make sure that
you do not include an eventually created directory, so that there exists a file win64/numpy/__init__.py.
That should be all you need to "import numpy".
About setuptools, you can switch to the Python.win64.framework directory that you mentioned and use
the python.exe there. I recommend using this script (also below), but you must keep in mind that
installing packages via Pip or easy_install will install them into Python.win64.framework and not into
your C4D preferences folder.
Also, when you want to use any third party modules in a Cinema 4D plugin, you should either provide
instructions how to install the required packages or distribute them with your plugin, but that is a whole
other story how to do it correctly.
https://plugincafe.maxon.net/topic/8229/10727_best-practice-for-imports
# Copyright (c) 2017 Niklas Rosenstein
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
import os
import urllib2
import shlex
def get_pip() :
url = 'https://bootstrap.pypa.io/get-pip.py'
scope = {'__file__': url, '__name__': '__main__'}
code = urllib2.urlopen(url).read()
exec(compile(code, url, 'exec'), scope)
def main() :
try:
import pip
except ImportError:
try:
get_pip()
except SystemExit as exc:
if exc.code != 0: raise
import pip
while True:
command = shlex.split(raw_input('$ pip '))
if command == ['exit']: break
pip.main(command)
if __name__ == '__main__':
main()
Cheers,
Niklas