Search code examples
python-3.xwebots

How to run Webots examples with MacPorts?


When i try to run the samples/robotbenchmark/squar_path example I first got the message:

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.

While a Python 3.7 version

python --version
Python 3.7.4

is available via my Macports environment

port version
Version: 2.5.4

So I think that Webots doesn't use the settings from my macports profile - how could i achive this? I tried setting the python path to

/opt/local/bin/python

in preferenes/general but then I ended up with a complaint:

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

And I have not seen an option to specify the library path ...


Solution

  • The library path is not recognized /Library/Frameworks/Python.framework/Versions/3.7/Python does not exist but the /opt/local//Library/Frameworks/Python.framework/Versions/3.7/Python one does ..

    So as a workaround in /Library/Frameworks i did a

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

    Now the robot starts...