ModuleNotFoundError: No module named 'alipay.aop' 怎么解决?百度无果,小白求救!!!

运行支付宝支付的代码如下
#!/usr/bin/env python

-- coding: utf-8 --

import logging

from alipay.aop.api.AlipayClientConfig import AlipayClientConfig
from alipay.aop.api.DefaultAlipayClient import DefaultAlipayClient

from alipay.aop.api.domain.AlipayTradeCreateModel import AlipayTradeCreateModel
from alipay.aop.api.request.AlipayTradeCreateRequest import AlipayTradeCreateRequest
from alipay.aop.api.response.AlipayTradeCreateResponse import AlipayTradeCreateResponse

logging.basicConfig(
level=logging.INFO,
format=’%(asctime)s %(levelname)s %(message)s’,
filemode=‘a’,)
logger = logging.getLogger(’’)

if name == ‘main’:
# 实例化客户端
alipay_client_config = AlipayClientConfig()
alipay_client_config.server_url = ‘https://openapi.alipaydev.com/gateway.do’
alipay_client_config.app_id = ‘2016102300747738’
alipay_client_config.app_private_key = ‘MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCN/9tQNeqL97O6I6JHMfEbRihtUC7Y10lmtax7BuVhNxjpj4Yrng74pLEvLQLwjzSKEgz2Pui66J40/xw5UXw38GaTMlo9PycuY3A4Vqkm3j58glChYuh5P1oAP1y7DzJviklSJi5S4PXWVjW84mGDFzMPJ7uANs0fd854iEyp8Kuk05NOpiietUOiPs839+eFSBD6GivMxXGaFhOeutsociWrnfouMDUNpawElLntD64gmquW9aIDQLXFRWgzNRYuNhDQR3B1k2jjIZyV3Wk5PhYvjMjxHeSavzqTbmxNpEnGm2mefOAQiyMcq7uuRxu8fJ8mHREWIE1vDmmt+5WRAgMBAAECggEAccugzd7nX9PZzEnSOovjVKActb2UTWH6CL1+w/j6ybWF2WaTd1DrXoddFxlTScT5rcxZZt1zVJYmcwIedDDBA3M8QKoRdxOtKpe1zvBkDin8mXs1cp/4/XGvhpNAlQfQu2Ju7855QSHW4TWlSwGAc7WbzYFh2ZYRPC6e4CkahvSOFr/jpJXg62xbDVak4I968bevlo9C8l6EUhkDNzr3u+xXhk/T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49cJtmBgIXLdGdQq25ytRl44o1QrWS0tJXb2nZqyX6HS8kWK2UyBfZ2Ao4m+MNLUtwdiSvhY/hrHODbb5XhD0zhCehDPHglRuip/eaPSh/xJFdgi9FiuH+8p3VvuPYaKf8x32PGpDyCohldmFK9VuKH41G59QGjlfsh/QJfob3KMH3qmhajF5otTs7A9IAL1sRrmLrxA4NDuUEFtJgi8Fm4gy8Vcdt6yKwUlq8T/R9h6c1nSRoAJR+Jmc/223cIguMNZCoppSDHE4f3PPeBdOh5CaJVnOzc2vlN0ViPbCsnxp4KTcen2XXWeMmf9fed/kK7xAaMNER4Yjw33L88jQIDAQAB’
client = DefaultAlipayClient(alipay_client_config, logger)

# 构造请求参数对象
model = AlipayTradeCreateModel()
model.out_trade_no = "20150320010101001";
model.total_amount = "88.88";
model.subject = "Iphone6 16G";
model.buyer_id = "2088102177846880";
request = AlipayTradeCreateRequest(biz_model=model)

# 执行API调用
try:
    response_content = client.execute(request)
except Exception as e:
    print(traceback.format_exc())

if not response_content:
    print("failed execute")
else:
    # 解析响应结果
    response = AlipayTradeCreateResponse()
    response.parse_response_content(response_content)
    # 响应成功的业务处理
    if response.is_success():
        # 如果业务成功,可以通过response属性获取需要的值
        print("get response trade_no:" + response.trade_no)
    # 响应失败的业务处理
    else:
        # 如果业务失败,可以从错误码中可以得知错误情况,具体错误码信息可以查看接口文档
        print(response.code + "," + response.msg + "," + response.sub_code + "," + response.sub_msg)

然后报错:
E:\Python37\python.exe E:/python-3.7.0/毕业设计/test3.py
Traceback (most recent call last):
File “E:/python-3.7.0/毕业设计/test3.py”, line 6, in
from alipay.aop.api.AlipayClientConfig import AlipayClientConfig
ModuleNotFoundError: No module named ‘alipay.aop’

Process finished with exit code 1

求救啊啊啊啊啊

  • 0
    点赞
  • 4
    评论
  • 0
    收藏
  • 打赏
    打赏
  • 扫一扫,分享海报

评论 4 您还未登录,请先 登录 后发表或查看评论
©️2022 CSDN 皮肤主题:游动-白 设计师:白松林 返回首页

打赏作者

盖冠

你的鼓励将是我创作的最大动力

¥2 ¥4 ¥6 ¥10 ¥20
输入1-500的整数
余额支付 (余额:-- )
扫码支付
扫码支付:¥2
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值