swig

ImportError: No module named _analog_swig

筅森魡賤 提交于 2020-08-09 12:45:23
问题 I am having issues getting python to import the _analog_swig gnuradio module in order to run gnuradio code on a Windows 8.1 64bit machine. Some background: I am running Python 2.7.10 (installed in C:\Python27) and have installed the latest gnuradio binary (v3.7.11.1/v1.3 64-Bit Any CPU) from here: http://www.gcndevelopment.com/gnuradio/downloads.htm. I have installed gnuradio to C:\Program Files\GNURadio-3.7 . I can run gnuradio companion and run flowgraphs from GRC successfully (which calls

ImportError: No module named _analog_swig

余生长醉 提交于 2020-08-09 12:44:35
问题 I am having issues getting python to import the _analog_swig gnuradio module in order to run gnuradio code on a Windows 8.1 64bit machine. Some background: I am running Python 2.7.10 (installed in C:\Python27) and have installed the latest gnuradio binary (v3.7.11.1/v1.3 64-Bit Any CPU) from here: http://www.gcndevelopment.com/gnuradio/downloads.htm. I have installed gnuradio to C:\Program Files\GNURadio-3.7 . I can run gnuradio companion and run flowgraphs from GRC successfully (which calls

Python Cookbook(第3版)PDF高清完整版免费下载|百度网盘|Python新手入门

非 Y 不嫁゛ 提交于 2020-08-06 09:20:22
百度云盘:Python Cookbook(第3版)PDF高清完整版免费下载 提取码:i2y5 豆瓣评分: 内容简介 《Python Cookbook(第3版)中文版》介绍了Python应用在各个领域中的一些使用技巧和方法,其主题涵盖了数据结构和算法,字符串和文本,数字、日期和时间,迭代器和生成器,文件和I/O,数据编码与处理,函数,类与对象,元编程,模块和包,网络和Web编程,并发,实用脚本和系统管理,测试、调试以及异常,C语言扩展等。 本书覆盖了Python应用中的很多常见问题,并提出了通用的解决方案。书中包含了大量实用的编程技巧和示例代码,并在Python 3.3环境下进行了测试,可以很方便地应用到实际项目中去。此外,《Python Cookbook(第3版)中文版》还详细讲解了解决方案是如何工作的,以及为什么能够工作。 《Python Cookbook(第3版)中文版》非常适合具有一定编程基础的Python程序员阅读参考。 作者简介 David Beazley是一位居住在芝加哥的独立软件开发者以及图书作者。他主要的工作在于编程工具,提供定制化的软件开发服务,以及为软件开发者、科学家和工程师教授编程实践课程。他最为人熟知的工作在于Python编程语言,他已为此创建了好几个开源的软件包(例如Swig和PLY),并且是备受赞誉的图书Python Essential

Building a module with setuptools and swig

微笑、不失礼 提交于 2020-06-13 12:29:30
问题 I have a bunch of SWIG interfaces (foo.i, bar.i, etc.). I want to build them into a Python (3.6.4) module for my platform (MS Windows), with setuptools. The module should include the SWIG-generated Python files (*.py), the binary extensions (*.pyd) and the compiled caches (*.pyc). My setup.py is essentially like this: from setuptools import setup, Extension from pathlib import Path paths=list(Path('.').glob('*.i')) py=[path.stem for path in paths] ext=[Extension('_' + path.stem, [str(path)])

How to convert numpy arrays to vector<int>& (reference) with SWIG

两盒软妹~` 提交于 2020-05-14 15:55:47
问题 My goal: Create 3 numpy arrays in python (2 of them will be initialized with specific values), then send all three of them through swig into a c++ function as vector references (this is in order to avoid copying over the data and loosing efficiency). Once in the c++ function, add 2 of the arrays and put their sum in the 3rd array. vec_ref.h #include <vector> #include <iostream> void add_vec_ref(std::vector<int>& dst, std::vector<int>& src1, std::vector<int>& src2); vec_ref.cpp #include "vec

How to convert numpy arrays to vector<int>& (reference) with SWIG

孤人 提交于 2020-05-14 15:55:27
问题 My goal: Create 3 numpy arrays in python (2 of them will be initialized with specific values), then send all three of them through swig into a c++ function as vector references (this is in order to avoid copying over the data and loosing efficiency). Once in the c++ function, add 2 of the arrays and put their sum in the 3rd array. vec_ref.h #include <vector> #include <iostream> void add_vec_ref(std::vector<int>& dst, std::vector<int>& src1, std::vector<int>& src2); vec_ref.cpp #include "vec

Faiss in python and GPU报错:NotImplementedError: Wrong number or type of arguments for overloaded f...

末鹿安然 提交于 2020-05-07 18:37:59
最近在玩faiss,运行这段代码的时候报错了: res = faiss.StandardGpuResources() flat_config = 0 index = faiss.GpuIndexFlatL2(res,d,flat_config) 报错内容见上: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "swigfaiss_gpu.py", line 2958, in __init__ this = _swigfaiss_gpu.new_GpuIndexFlatL2(*args) NotImplementedError: Wrong number or type of arguments for overloaded function 'new_GpuIndexFlatL2'. Possible C/C++ prototypes are: faiss::gpu::GpuIndexFlatL2::GpuIndexFlatL2(faiss::gpu::GpuResources *,faiss::IndexFlatL2 *,faiss::gpu::GpuIndexFlatConfig) faiss::gpu::GpuIndexFlatL2::GpuIndexFlatL2

VS2017编译GDAL(64bit)+解决C#读取Shp数据中文路径的问题

喜你入骨 提交于 2020-05-07 18:36:59
编译GDAL过程比较繁琐,查阅了网上相关资料,同时通过实践,完成GDAL的编译,同时解决了SHP数据中文路径及中文字段乱码的问题,本文以“gdal-2.3.2”版本为例阐述整个编译过程。 一、编译准备 1、编译工具是VS2017,编译前需要下载“gdal-2.3.2”和“swigwin-3.0.12”,下载链接如下: GDAL:http://trac.osgeo.org/gdal/wiki/DownloadSource swigwin:https://sourceforge.net/projects/swig/files/swigwin/ 2、在“D盘”新建目录“GDAL”,将两个压缩包解压到该目录中,同时新建一个文件夹用于存放编译结果(如“D:\GDAL\GDAL\GDAL232“”),如图所示: 3、修改“D:\GDAL\gdal-2.3.2\nmake.opt”文件,如下图: 文件“nmake.opt”修改如下: 修改57行,GDAL_HOME = "D:\GDAL\GDAL\GDAL232"(编译后文件的生成目录) 修改86行,SWIG = D:\GDAL\swigwin-3.0.12\swig.exe(这个必须是完全路径) 修改184行,去掉“#”,效果为WIN64=YES 修改960行,去掉后边的下划线,效果为SYM_PREFIX= 二、编译C++ 以管理员运行【开始】

linux下实现Python调用海康威视SDK

强颜欢笑 提交于 2020-05-04 02:55:12
---作者吴疆,未经允许,严禁转载,违权必究--- ---欢迎指正,需要源码和文件可站内私信联系--- ----------- 点击此处链接至博客园原文 ----------- 功能说明:将C++版的海康威视官方SDK封装、编译成动态共享对象(linux中称为DSO,Dynamic Shared Objects,windows中称动态链接库),供Python调用实现相关功能 运行环境:ubuntu14.04或ubuntu16.04、opencv2.4.13.5或opencv2.4.13.6、swig3.0.8、codeblocks16.01、Python2.7.6(仅在上述运行环境中验证过该博客有效性) 一、相关介绍 参考链接: swig扩展opencv Python调用C++ (极重要参考) 本节主要介绍在linux系统下将C++源文件封装、编译为.so动态共享对象的大致流程和细节。swig是simplified wrapper and interface generator的缩写,是一个非常优秀的开源工具,支持将 C/C++代码与任何主流脚本语言相集成。其中,必须编写一个额外的接口文件(.i文件)来作为swig(终端工具)的入口。这里引用上文中(未调用opencv的简单)例子对该流程进行叙述。(若调用了opencv函数,则需利用opencv-swig接口文件,将在“四

如何实现 C/C++ 与 Python 的通信?

大憨熊 提交于 2020-04-29 18:52:13
属于混合编程的问题。较全面的介绍一下,不仅限于题主提出的问题。 以下讨论中,Python指它的标准实现,即CPython(虽然不是很严格) 本文分4个部分 1. C/C++ 调用 Python (基础篇)— 仅讨论Python官方提供的实现方式 2. Python 调用 C/C++ (基础篇)— 仅讨论Python官方提供的实现方式 3. C/C++ 调用 Python (高级篇)— 使用 Cython 4. Python 调用 C/C++ (高级篇)— 使用 SWIG 练习本文中的例子,需要搭建Python扩展开发环境。具体细节见[搭建Python扩展开发环境 - 蛇之魅惑 - 知乎专栏](http://zhuanlan.zhihu.com/python-dev/20150730) **1 C/C++ 调用 Python(基础篇)** Python 本身就是一个C库。你所看到的可执行体python只不过是个stub。真正的python实体在动态链接库里实现,在Windows平台上,这个文件位于 %SystemRoot%\System32\python27.dll。 你也可以在自己的程序中调用Python,看起来非常容易: ``` //my_python.c #include <Python.h> int main(int argc, char *argv[]) { Py