Base64.encode字符串在python中不起作用,类型错误:内存视图:需要类似字节的对象

Base64.encode字符串在python中不起作用,类型错误:内存视图:需要类似字节的对象,python,anaconda,Python,Anaconda,我正在尝试用python进行实时流媒体,我在这一行中发现了错误,我在internet和堆栈溢出上尝试了所有可能的解决方案,但在我的代码中没有成功,我使用的是Anaconda Prompt python 3.6.4 auth_encoded = base64.encodestring('%s:%s' % (user, password))[:-1] 我也试过了 auth_encoded=base64.b64encode(base64.b64decode(“%s:%s”)(用户, 密码() au

我正在尝试用python进行实时流媒体,我在这一行中发现了错误,我在internet和堆栈溢出上尝试了所有可能的解决方案,但在我的代码中没有成功,我使用的是Anaconda Prompt python 3.6.4

auth_encoded = base64.encodestring('%s:%s' % (user, password))[:-1]
我也试过了

  • auth_encoded=base64.b64encode(base64.b64decode(“%s:%s”)(用户, 密码()

  • auth_encoded=base64.b64encode(字节(“%s:%s%”(用户,密码)))

  • auth_s=urllib.parse.unquote((“%s:%s%”(用户,密码))
    auth_bytes=auth_s.encode()
    encoded_bytes=base64.encodestring(auth_bytes)

请重新格式化您的代码。列表不适合编写代码,因为它有格式限制。请不要发布代码图片或错误消息,请直接在此处发布文本。