Webots Python3 "ModuleNotFound" Error MacOS

445 views Asked by At

I'm trying to use python3 with Webots and have been finding trouble with the Webots path on my mac. Simply leaving the python command preference in webots as this calls the mac default python 2.7. If I try python3, Webots doesn't understand that command. I therefore directly used the python 3.9 executable /usr/local/opt/[email protected]/bin/python3.9 in the preferences. However when I do this, webots then cannot find its own modules such as controllers or drivers and I get a ModuleNotFound Error.

I've also set my default python command to default to python3.9 by modifying my .bash_profile, however it seems like webots doesn't read that.

Has anyone run into similar issues? Thanks in advance!

1

There are 1 answers

0
FatSaturn31 On

I was able to fix my solution by changing to python 3.8 and modifying my system wide profile and adding the following lines to ensure that all of the modules were being correctly added to the path.

export PYTHONPATH=/Applications/Webots.app/lib/controller/python38_brew:$PYTHONPATH
export DYLD_LIBRARY_PATH=/Applications/Webots.app/lib/controller:$DYLD_LIBRARY_PATH
export LD_LIBRARY_PATH=/Applications/Webots.app/lib/controller:/Applications/Webots.app/lib/controller/python38_brew:$LD_LIBRARY_PATH