代码中两处错误,需要改下:1.str_result = base64.b64encode(result),其中result是字符串,不符合b64encode()位置参数要求(s为字节类型),将改成bytes_result2.s=str_result,由于上述返回的结果也是字节类型,后面用字符串处理仍会报错,改成:s=str_result.decode('utf-8')