当弄乱 Python.h 时,我收到了这个错误:
AttributeError: 'module' object has no attribute 'argv'
C++ 代码:
#include "stdafx.h"
#include "C:/Python27/include/Python.h"
#include <iostream>
using namespace std;
int main()
{
Py_Initialize();
PyRun_SimpleString("import sys\nprint sys.argv[0]");
}
在 Python 中是:
import sys
print sys.argv[0]
我错过了什么?