Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I have been searching for the way to call Python from MATLAB on Google and YouTube. However, I got confused due to the many ways of doing so.
I have a Python library DESlib downloaded. I have a program from MATLAB that needs that library to perform dynamics classifier selection. No one has developed such a library for MATLAB. I can only found for Python.
So, how I do that call this library from MATLAB?
If your MATLAB version is new enough (the following definitely works on R2019a), MATLAB has builtin support for calling python functions.
Say module is your python library that you downloaded and you want to use a function func in that module, all you need to do is just
py.module.func(<arguments>)
See here for more details.
module has to be in the python search path, otherwise add it as detailed here
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I have a Perl script that can convert a binary file into a text file. Rather than rewriting the script in Python, I was wonder I could use this Perl script in my Python program, package it, and distribute it to computers that don't have Perl preinstalled into it.
Perl has ways to embed a perl interpreter into another program: mod_perl for Apache is such a thing. If you wanted to make a Python module that had an embedded perl in it, you could probably make that happen.
It's probably less work to rewrite the functionality in Python though.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
When it comes to import the library.
I got an error that the module is not found
I'm using Python 2.7
Windows with 32 bit
Is there a solution?
The module was called Tkinter, with a capital T, in Python 2.7.
Python 3 renamed most stdlib modules that didn't fit the coding standard (mostly because they'd been added before there was a coding standard). By 2018, most books, YouTube tutorials, Stack Overflow answers, blog posts, etc. are going to show you Python 3, so if you want to or have to keep using Python 2.7 for some reason, you need to know how to find the Python 2 docs.
Fortunately, once you're at the Python 3 docs, this is easy: just go to the little option menu in the navigation bar that says "3.7" or whatever, and change it to "2.7".
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I have a large performance sensitive library written in C++11 with variadic templates and model classes. This is a header only C++ library.
I want to write the Python bindings for this library.
The python bindings should support Python 2.7 and Python 3.x.
My problem is I am not finding a way to create bindings between C++ and Python. I did see references to Boost.Python and SWIG, however, I could not find anything that clearly identified how to create the bindings between C++ and Python.
What is the simplest, clearest, step-by-step method of creating a binding?
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
i have been working on a project on python for physics, using enthought canopy, i wished to enhance it by modifying it to a cython code. Could someone pleases tell me how to rewrite a python to cython codes in canopy? or do i need a separate software?
Just to add, it's probably better to use libraries which already incorporate Cython. NumPy for example, has virtually any array handling you can think of and has been optimized around things like matrix multiplication. Smart people have already done the work for you, so see if you can get that module to do what you need then as a last resort rewrite your code using Cython.
The Canopy Python distribution is bundled with Cython. However to use it, you will need a C compiler on your machine, which you may or may not already have. The Cython documentation has a good overview of Cython basics, including a brief description of where to get/find a C compiler for you operating system.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I use Python api for OpenCV Library and it's great. I want to adapt the same technology to my own C++ library. Here is the source code:
https://github.com/Itseez/opencv/tree/master/modules/python/src2
As far as I know this is not SWIG, or Cython but a manual approach. Can someone please explain the architecture of the Python wrapping?
the python scripts in opencv\modules\python\src2 are used to generate the api
first hdr_parser.py is run on the opencv c++header files (just try to run it!), to collect the classes/functions(that's what the EXPORTS_W and CV_WRAP tags are for in the c++ headers),
then gen2.py is the 'backend', which generates the python wrappers.
the java / matlab bindings are done in the very same way (just different backends)