![](/img/trans.png)
[英]Python: AttributeError: 'module' object has no attribute 'socketpair'
[英]Python: AttributeError: 'module' object has no attribute
我用swig從c創建一個python文件。 我已將c文件轉換為.py文件,當我嘗試調用c程序的函數時,出現錯誤AttributeError:'module'對象沒有屬性'fact'
我的C文件是
/* File : example.c */
#include <time.h>
double My_variable = 3.0;
int fact(int n) {
if (n <= 1) return 1;
else return n*fact(n-1);
}
int my_mod(int x, int y) {
return (x%y);
}
char *get_time()
{
time_t ltime;
time(<ime);
return ctime(<ime);
}
我的界面文件是
/* example.i */
%module example
%{
/* Put header files here or function declarations like below */
extern double My_variable;
extern int fact(int n);
extern int my_mod(int x, int y);
extern char *get_time();
%}
有人可以幫我嗎?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.