如题:
究其主要原因是py标准库的各个模块路径未找到。
通过void PySys_SetPath(char *path)注意参数说明,为分号隔开的路径列表;
void FindFile(const CString &strPath,CString &strList)
{
if(strList.IsEmpty())
strList = strPath;
else
strList = strList + _T(";") + strPath;
CFileFind ff;
CString str = strPath + _T("\\*.*");
BOOL bFind = ff.FindFile(str);
while(bFind)
{
bFind = ff.FindNextFile();
if(ff.IsDirectory()&& !ff.IsDots())
{
CString str = ff.GetFilePath();
// PySys_SetPath(CT2A(str).m_psz);
//
TRACE(str);
TRACE(_T("\n"));
FindFile(str,strList);
}
}
}CString strList = _T("F:\\");
CString strPath = _T("F:\\python\\Python26\\Lib");
FindFile(strPath,strList);
PySys_SetPath(CT2A(strList).m_psz);
Python路径配置详解
本文介绍了一个关于Python标准库模块路径未被正确识别的问题,并提供了一段C++代码用于递归地查找目录及其子目录下的所有文件,同时展示了如何使用PySys_SetPath函数来设置Python的搜索路径。
4150

被折叠的 条评论
为什么被折叠?



