简体   繁体   English

如何导入 Cloudant 模块以通过 IBM 云服务器少功能 python 3.9 操作来操作现有文档?

[英]How to import Cloudant module to manipulate existing documents via IBM cloud server less function python 3.9 actions?

I am new to Cloud SDK, and I tried to invoke the following action, but I get error : " stderr: ModuleNotFoundError: No module named 'cloudant'",.我是 Cloud SDK 的新手,我尝试调用以下操作,但出现错误:“stderr: ModuleNotFoundError: No module named 'cloudant'”。

  • NOTE :注意

  • Console ==> IBM cloudant python 3.9 SDK: No module named 'cloudant'"控制台 ==> IBM cloudant python 3.9 SDK:没有名为“cloudant”的模块”

  • CLI ==> Python 3.86 : accepted the module without error CLI ==> Python 3.86:接受模块没有错误

  • Question :==> I need to know how to do it using the CLI.问题:==>我需要知道如何使用 CLI 来完成。

If you have a solution please let me know in time.如果有解决办法请及时告诉我。 Thank You!!.谢谢你!!。

from cloudant.client import Cloudant
import requests
import json
   

dict = {"COUCH_USERNAME": "--bluemix",
"IAM_API_KEY": "---bluemix"}

 def main(dict):
        client = Cloudant.iam(user_name=dict["COUCH_USERNAME"],
        api_key=dict["IAM_API_KEY"],
        connect=True)
        my_database=client['reviews']
        return my_database.json```

Yes I did.是的,我做到了。 I have used Python 3.7 and it works.我使用过 Python 3.7,它可以工作。 However, it is depreciated on IBM cloud但是,它在 IBM 云上已折旧

The Python cloudant module is EOL and is replaced by the ibmcloudant module . Python cloudant模块已停产并被ibmcloudant模块取代。

As per the Functions documentation the 3.9 runtime contains the new ibmcloudant module.根据Functions 文档,3.9 运行时包含新的ibmcloudant模块。

You should migrate your action code to use ibmcloudant instead of cloudant .您应该迁移您的操作代码以使用ibmcloudant而不是cloudant If you can't want to migrate your code then you could force it to use the 3.7 runtime with --kind python:3.7 or create a custom 3.9 runtime with the cloudant module installed.如果您不想迁移您的代码,那么您可以强制它使用带有--kind python:3.7的 3.7 运行时,或者创建一个安装了cloudant模块的自定义 3.9 运行时。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何将 IBM cloudant 数据库连接到 IBM 云(云基础设施)上的 python 应用程序代码? - how to connect IBM cloudant database to python app code already on IBM cloud(cloud foundary)? 无法在 python 3.9 中导入我自己的模块 - Not able to import my own module in python 3.9 如何使用virtualenv将Python函数上载到IBM Cloud - How to upload Python function with virtualenv to IBM cloud 在 Python3.9 中导出和导入定义的函数 - Export and Import a defined function in Python3.9 如何使用Python通过Cloud Dataflow将CSV文件导入Cloud Bigtable? - How to import CSV file into Cloud Bigtable via Cloud Dataflow with Python? 如何导入可通过 url 访问的 python 模块 - How to import a python module accessible via an url 如何将文档导入 python? - How to import documents into python? 如何使用现有的python模块名称创建自定义模块并将该系统模块导入自定义模块 - How to create custom module with existing python module name and import that system module in the custom module 如何使用 cloud-init 和 CDK 在 Amazon Linux 2 上安装 python 3.9 - How to install python 3.9 on Amazon Linux 2 with cloud-init and CDK Python 3.9 导入问题(modulenotfounderror) - Python 3.9 import problem (modulenotfounderror)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM