Note: To use Python 3.x on macOS, it is recommended to set the absolute path to the python3 executable (e.g. If you need Homebrew Python for Apple Silicon, you will have to recompile the Python wrapper by yourself, as explained below. Python 3.7 and Homebrew Python are not provided for Apple Silicon processors. To check the versions of Python installed on your system, you can type in a terminal: python -version, python3.8 -version, python3 -version, etc. You can install Python 3.7, 3.8, 3.9 or 3.10 from the Python web site or using Homebrew. Most of the Linux distributions have Python 3 already installed. However, it is parsed and a warning is displayed in case of mismatch, e.g., if the version specified on the shebang header line mismatches the actual version of Python used by Webots. On Windows, the shebang header line option is not supported. On Linux and macOS, it is also possible to override this value by setting a standard Python shebang header line in your main python controller file, for example: If specified in the runtime.ini file of a controller, this Python command will be executed instead of the default one to launch this controller. It is also possible to set a different version of Python for each robot controller by editing the section of the runtime.ini file in each robot controller directory and setting the COMMAND value to python3, python3.10 or python3.8, etc. If you set it for example to python3.8 instead of python, this version of Python will be used by default, if available from the command line. If you want to use a different version of Python, please install it if needed and configure your environment so that it becomes the default python version when called from the command line in a terminal.Īlternatively, you can change the default Python command from the Webots Preferences in the General tab. Webots starts Python using the standard python command line.Īs a consequence, it executes the first python binary found in the current PATH. The Python API of Webots supports Python versions 3.7, 3.8, 3.9, and 3.10.Īlternatively to the Webots built-in editor, P圜harm can be used to edit and launch Python controllers, see the Using P圜harm with Webots chapter for a step-by-step procedure. The classes are either representations of a node of the scene tree (such as Robot, LED, etc.) or utility classes (such as Motion, ImageRef, etc.).Ī complete description of these functions can be found in the reference guide while the instructions about the common way to program a Python controller can be found in this chapter. The Python API is currently composed of a set of about 25 classes having about 200 public functions located in the module called controller. This implies that their class hierarchy, their class names and their function names are almost identical. The Python API has been generated from the C++ API by using SWIG.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |