0

当我尝试从另一个文件夹中的 Python 文件导入到 FreeCAD 时,我遇到了一个小问题。Python 文件位置:c:/users/workspace/main.py FreeCAD:c:/program files (x86)/FreeCAD0.13/bin

当我尝试使用命令导入时 from FreeCAD import *(我将 FreeCAD 的路径附加到sys sys.path.append (" path-To-FreeCADs-BinFolder " ) 我得到一个错误:

FreeCAD 0.13, Libs: 0.13R1828
Initialization of FreeCAD failed:
While initializing FreeCAD the  following exception occurred:
''module' object has no attribute 'PrintError''
Please contact the application's support team for more information. "

但是当我在 FreeCAD 的文件夹中创建一个 Python 文件时,它可以工作。我的意思是像我上面写的那样导入 FreeCAD。

ps:我的 Python 版本是 2.7.5,而 FreeCAD 是:0.13

4

1 回答 1

3

I had the same problem and surfing around I found that Win version doesn't support Python2.7, so you have to install Python 2.6, open a shell and do the same import sys sys.path.append('C://Program Files//FreeCAD0.13/bin') import FreeCAD

Then it should work

于 2013-10-14T08:07:08.737 回答