如何使用 MacPorts 运行 Webots 示例?

How to run Webots examples with MacPorts?

当我尝试 运行 samples/robotbenchmark/squar_path 示例时,我首先收到消息:

DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of Webots will drop support for Python 2.7.
[square_path_supervisor] DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of Webots will drop support for Python 2.7.

虽然 Python 3.7 版本

python --version
Python 3.7.4

可通过我的 Macports 环境使用

port version
Version: 2.5.4

所以我认为 Webots 不使用我的 macports 配置文件中的设置 - 我怎么能做到这一点?我尝试将 python 路径设置为

/opt/local/bin/python

在 preferenes/general 但后来我投诉了:

ImportError: dlopen(/Applications/Webots.app/lib/python37/_controller.so, 2): Library not loaded: /Library/Frameworks/Python.framework/Versions/3.7/Python

而且我还没有看到指定库路径的选项...

库路径无法识别/Library/Frameworks/Python.framework/Versions/3.7/Python不存在但是/opt/local//Library/Frameworks/Python.framework/Versions/3.7/Python 一个 ..

因此,作为 /Library/Frameworks 中的解决方法,我做了一个

sudo ln -s /opt/local/Library/Frameworks/Python.framework . 

现在机器人启动...

您可以轻松地全局指定 Webots 应该在 Webots 首选项中使用的 python 版本。 您可以从 'Tools / Preferences' 菜单打开首选项:

然后您只需更改 'Python command' 首选项:

https://cyberbotics.com/doc/guide/preferences#general