首先是可以从报错内容看到提示指定的python版本,由于是新电脑,压根还没装python,所以先去官网下载了一下

然后文件报错:

ModuleNotFoundError: No module named ‘protobot’ 意思应该是没有protobot这个python包

然后我在下载的文件夹里的电机驱动函数库找到了protobot这个文件夹,然后把它放到了webots工程里,

image-20240219224457877

在readme文件里看到安装它的方式

1
2
cd src 
pip install -e .

按照上面的输入,然后出现下面报错

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
Installing build dependencies ... error
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> [8 lines of output]
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1122)'))': /simple/setuptools/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1122)'))': /simple/setuptools/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1122)'))': /simple/setuptools/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1122)'))': /simple/setuptools/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1122)'))': /simple/setuptools/
Could not fetch URL https://pypi.org/simple/setuptools/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/setuptools/ (Caused by SSLError(SSLEOFError(8, 'EOF occurred in violation of protocol (_ssl.c:1122)'))) - skipping
ERROR: Could not find a version that satisfies the requirement setuptools>=40.8.0 (from versions: none)
ERROR: No matching distribution found for setuptools>=40.8.0
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

然后我问chatgpt,它列出的原因里有一条说可能是代理的原因,然后我把梯子关了,报错少了很多:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
 Installing build dependencies ... error
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
exit code: 1
╰─> [2 lines of output]
ERROR: Could not find a version that satisfies the requirement setuptools>=40.8.0 (from versions: none)
ERROR: No matching distribution found for setuptools>=40.8.0
[end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× pip subprocess to install build dependencies did not run successfully.
exit code: 1
╰─> See above for output. 我把梯子关了之后还剩这些报错

继续问chatgpt,回答说

image-20240219225116935

先是pip install –upgrade setuptools,然后还是报错,然后使用清华大学镜像,pip install setuptools -i https://pypi.tuna.tsinghua.edu.cn/simple,然后就Ok了。接着就继续前面的cd src , pip install -e .就可以正常安装这个protobot包了,中间电脑不要熄屏,以免下载中断报错,得重新再下载。

这样,这个webots工程就正常跑起来了,这次问题的原因主要还是自己对python环境的不熟悉,安装python包都不知道怎么装。

image-20240219225436046