当你的webots报错
WARNING: "python.exe" was not found.
Webots requires Python version 3.9, 3.8 or 3.7 from python.org in your current PATH.
To fix the problem, you should:
1. Check the Python command set in the Webots preferences.
2. Check the COMMAND set in the [python] section of the runtime.ini file of your controller program if any.
3. Fix your PATH environment variable to use the required Python 64 bit version (if available).
4. Install the required Python 64 bit version and ensure your PATH environment variable points to it.
此时,你需要先下载python安装包,python官网:Download Python | Python.org
然后找到路径,这里以python3.9为例
C:\Users\YourUsername\AppData\Local\Programs\Python\PythonXX
将这添加至webots工具下面有个首选项
改成如图所示:
当然也可以:
添加 Python 路径到 PATH 环境变量:
- 右键点击“此电脑”或“计算机”图标,然后选择“属性”。
- 点击“高级系统设置”,然后点击“环境变量”按钮。
- 在“系统变量”部分找到并选择
Path
,然后点击“编辑”按钮。 - 点击“新建”,并添加 Python 的安装路径,例如
C:\Users\YourUsername\AppData\Local\Programs\Python\Python39
。 - 再次点击“新建”,并添加 Python 的
Scripts
目录,例如C:\Users\YourUsername\AppData\Local\Programs\Python\Python39\Scripts
。