我目前正在开发一个项目,以便从FreeCAD获取数据,以便在外部脚本中使用。
我的FreeCAD安装:
OS: Windows 10 Word size of OS: 64-bit Word size of FreeCAD: 64-bit Version: 0.18.4 (GitTag) Build type: Release Branch: releases/FreeCAD-0-18 Hash: 980bf9060e28555fecd9e3462f68ca74007b70f8 Python version: 3.6.6 Qt version: 5.6.2 Coin version: 4.0.0a OCC version: 7.3.0 Locale: German/Germany (de_DE)
并且在将其导入到python脚本时遇到问题。
我使用的是Python 3.7.4
我的源码:
import sys
# Path to FreeCAD
FREECADPATH = 'C:\FreeCAD 0.18\bin'
def import_freecad(path_freecad):
"""Try to import FreeCAD on path_freecad"""
sys.path.append(path_freecad)
try:
import FreeCAD
except:
print("Could not import FreeCAD")
import_freecad(FREECADPATH)这段代码总是会引发预期。我遵循了一个教程pdf,你可以很容易地在谷歌上找到它。
有谁有办法解决这个问题吗?还是自己解决了问题?
发布于 2020-02-29 20:07:12
你试过“蟒蛇之道”吗?看起来更简单。您可以创建自己的虚拟环境。(https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#creating-an-environment-with-commands)
然后只需输入终端:
conda install -c conda-forge/label/cf201901 freecadhttps://stackoverflow.com/questions/59422401
复制相似问题