How do you install the blaze module (Continuum ana

2019-04-01 11:43发布

问题:

How do you install blaze natively (i.e., not in a virtual environment) in Python? The only instructions I find are on in the package's doc (see link), and here, in a virtual environment.

回答1:

I didn't find any instructions anywhere online for this, but it's relatively straightforward.

About my platform/tools I used:

  • Mac OSX (Mountain Lion)
  • Python 2.7.3
  • homebrew
  • pip
  • It looks like you might need to install Cython, not sure as I already had it installed. You can do this with pip install Cython.

First, brew install llvm.

Here are the packages you need. You can pip all of them:

  • llvmpy
  • numba
  • meta
  • ply
  • blosc
  • sphinx -- for doc
  • aterm

Once you've pipped everything,

  • cd /tmp up to you, of course...
  • sudo git clone git@github.com:ContinuumIO/blaze-core.git
  • cd /tmp/blaze-core
  • sudo make build
  • sudo make docs
  • sudo python setup.py install (Whether you need sudo depends on where you git things to, of course.)

I've had trouble running the tests, it looks like there's an error in an __init__.py file somewhere, but I can't be for sure. I can't get the unit tests to run, so take "successful installation" with a grain of salt. At any rate, I can do a spot check to see that the module imports correctly:

>>> import blaze
>>> from blaze import Array, dshape
>>> ds=dshape('2,2,int')
>>> a = Array([1,2,3,4],ds)
>>> a
Array
  datashape := 2, 2, int 
  values    := [CArray(ptr=140454075688080)] 
  metadata  := [manifest, arraylike] 
  layout    := Chunked(dim=0) 
[1 2 3 4]