沙箱环境地址:https://openhome.alipay.com/platform/appDaily.htm?tab=info

 

1.将Crypto放到site-packages下

2、OSError:Cannot load native module 'Crypto.Cipher._raw_ecb':Trying '_raw_ecb.cp36-win_amd64.pyd':cannot load library 'C:\Users\admin\AppData\Local\Temp\_MEI160382\Crypto\Util\..\Cipher\_raw_ecb.cp36-win_amb64.pyd':这个问题卡了我很久,前前后后尝试了很多中方法,粘出其中两种的链接

https://github.com/Legrandin/pycryptodome/issues/155

https://github.com/pyinstaller/pyinstaller/issues/2881

最后经过多次尝试和查找资料发现 Crypto对应的是pycryptodome包,所以出现这个问题。具体操作为pip list 查看当前安装包中是否有pycryptodome包,若有 则pip uninstall pycryptodome,卸载pycryptodome包,安装原包 pip install pycrypto(若失败使用 conda install pycrypto)。

3.pip install Crypto

 

4.生成支付配置实例

    def ali(self):

        # 沙箱环境地址:https://openhome.alipay.com/platform/appDaily.htm?tab=info
        app_id = "2016092000558535"
        # POST请求,用于最后的检测
        notify_url = "http://182.61.36.131:8000/page2/"
        # notify_url = "http://www.wupeiqi.com:8804/page2/"
        # GET请求,用于页面的跳转展示
        return_url = "http://182.61.36.131:8000/page2/"
        # return_url = "http://www.wupeiqi.com:8804/page2/"
        merchant_private_key_path = "keys/应用私钥2048.txt"
        alipay_public_key_path = "keys/myalipay_public_2048.txt"
        alipay = AliPay(
            appid=app_id,
            app_notify_url=notify_url,
            return_url=return_url,
            app_private_key_path=merchant_private_key_path,
            alipay_public_key_path=alipay_public_key_path,  # 支付宝的公钥,验证支付宝回传消息使用,不是你自己的公钥
            debug=True,  # 默认False,
        )
        return alipay
alipay

相关文章:

  • 2021-08-03
  • 2021-11-17
  • 2021-07-16
  • 2022-12-23
  • 2021-12-14
  • 2021-12-17
  • 2022-12-23
  • 2022-02-27
猜你喜欢
  • 2021-09-25
  • 2022-12-23
  • 2021-12-04
  • 2022-12-23
  • 2022-01-22
  • 2022-12-23
相关资源
相似解决方案