【发布时间】:2021-03-08 19:30:33
【问题描述】:
https://bugs.python.org/issue37424 有解决方法吗?
那个虫子在咬我。当我使用sudo apt install python3 安装时,我使用的是具有 Python 3.7.3 的 Raspberry Pi OS。
不幸的是,该错误仅在 Python 3.7.5 及更高版本中得到修复。
- 在 Python 3.7.3 上是否有解决方法?
- 如果没有,有人可以详细说明如何(我想,编译和)在 Raspberry Pi OS 上安装 Python 3.7.5(或更高版本)吗?我被告知它“复杂”并且可能会破坏其他东西(请参阅https://www.raspberrypi.org/forums/viewtopic.php?t=291158)
我只需要超时工作。
FWIW,这是我的代码:
def command(string, verbose=None, echo_commands=ECHO_COMMANDS, timeout=SHORT_TIMEOUT):
''' Executes string as a command by the OS.
Returns subprocess.CompletedProcess (stout, stderr, returncode, etc.).
Note usual security precautions since shell=True (DO NOT use this with user input).
'''
if verbose is None:
verbose = VERBOSE
while True:
try:
if echo_commands:
print("command:", string)
cp = subprocess.run(string, shell=True, capture_output=True, text=True, timeout=timeout)
if verbose:
print(cp.stderr, cp.stdout)
return cp
except Exception as e:
print(e)
reboot_camera() #...and try again
【问题讨论】:
-
您应该可以通过
apt install python3.8(或其他方式)来获取特定版本。apt search python3会给你一个选项列表。 -
@Carcigenicate 唉,'apt search python3 | grep \'stable 3.8\'' 没有返回任何有用的东西(只是一些包)。
标签: python python-3.x raspberry-pi