Installing pymatbridge on Windows

后端 未结 3 1574
醉话见心
醉话见心 2021-01-14 08:22

In version 0.3 of pymatbridge, an additional dependency was added for ZMQ. To install this version, you might therefore need to compile a messenger mex extensio

3条回答
  •  耶瑟儿~
    2021-01-14 08:59

    Here's my setup and build instructions; apologies for the verbosity -- this is from a write-up I did for my lab notebook.

    Specifications:

    Windows 8.1 (64 bit)
    Anaconda 1.9.1
    python 2.7.6
    MinGW
    TDM GCC 4.8.1
    

    First I installed MS Visual C++ & SDK 7.1. Possible reason for the install to fail quite early on is the presence of other Visual C++ compiler versions and/or SDKs -- before successfully installing SDK 7.1 I had to uninstall quite a few of them.

    First, using the Windows SDK 7.1 Command Prompt, I

    mex -setup
    

    and selected the newly installed compiler. In my case

    Select a compiler:
    [1] Microsoft Software Development Kit (SDK) 7.1 in 
    C:\Program Files (x86)\Microsoft Visual Studio 10.0
    
    [0] None
    
    Compiler:
    

    I elected to pick number 1. Next I downloaded and installed a prebuilt 64 bit ZMQ 3.2.4, and from the ZMQ 3.2.4 install location, C:\Program Files\ZeroMQ 3.2.4\lib, I copied libzmq-v90-mt_3_2_4.lib, and libzmq-v90-mt_3_2_4.dll from C:\Program Files\ZeroMQ 3.2.4\bin to the messenger build directory, ~\python-matlab-bridge\messenger\src. I also put zmq.h and zmq_utils.h into that directory but as of now am unsure if they are really necessary.

    Then, in the Windows SDK 7.1 Command Prompt, I cded into the messenger\src directory and issued

    mex messenger.c libzmq-v90-mt-3_2_4.lib -O -output messenger
    

    to obtain a messenger.mexw64. Finally, in the ~\python-matlab-bridge directory, using MinGW, I just

    python setup.py install
    

    This automatically put the built package into my Anaconda\Lib\site-packages along with an egg info. In Anaconda\Lib\site-packages\pymatbridge\matlab there is the messenger.mexw64 that was built earlier -- from ~\python-matlab-bridge\messenger\src. I also copied to Anaconda\Lib\site-packages\pymatbridge\matlab all other .dlls, .libs and .hs for good measure. Now in the iPython 2.7 console, or an iPython Notebook, I can

    %load_ext pymatbridge
    

    successfully.

提交回复
热议问题