[英]Python import simple_salesforce in Databricks gives: No module named cryptography.hazmat.primitives.asymmetric.ed25519
I'm trying to use Azure Databricks to launch Python script that imports the library: "simple_salesforce"我正在尝试使用 Azure Databricks 启动导入库的 Python 脚本:“simple_salesforce”
I have installed the library as shown on the picture bellow, please note that while installing the library the name should be "simple-salesforce" and while importing it "simple_salesforce" (just to mention that I didn't mistaken the name): Installation of the library我已经安装了如下图所示的库,请注意,安装库时名称应为“simple-salesforce”,导入时应为“simple_salesforce”(仅提一下我没有记错名称):安装图书馆的
As shown on the picture bellow, the library was installed successfully: simple-salesforce installed如下图所示,库安装成功: simple-salesforce installed
When try to import it in my workspace, using:当尝试将其导入我的工作区时,使用:
import simple_salesforce
I get the following error (see the error picture bellow):我收到以下错误(请参阅下面的错误图片):
ImportError: No module named 'cryptography.hazmat.primitives.asymmetric.ed25519'
I've tried to install the "cryptography" library with the same method I used to install the other libraries (see the picture bellow), but I still get the same error: cryptography我尝试使用与安装其他库相同的方法安装“密码学”库(见下图),但我仍然收到相同的错误:密码学
Is there any step that I missed?有没有我错过的步骤?
Best regards,此致,
You don't have the library "cryptography" installed.您没有安装库“密码学”。 It is very likely that you are using a Databricks runtime version of 5.5 LTS or less, with one worker.您很可能正在使用 5.5 LTS 或更低版本的 Databricks 运行时版本,只有一名工作人员。
The problem is that you have a Databricks cluster with Python3 and the notebook is running on a Python2 kernel.问题是您有一个带有 Python3 的 Databricks 集群,并且笔记本在 Python2 kernel 上运行。
Method 1方法一
Check if you have python 3:检查您是否有 python 3:
%sh
python3 --version
Then install pip3:然后安装 pip3:
%sh
sudo apt install python3-pip
After that you can install "cryptography"之后,您可以安装“密码学”
Method 2方法二
I highly recommand this method, which consists of using 7.4 Databricks Runtime version with a minimum of 2 workers, then you will have python3 and the library "cryptography" installed by default.我强烈推荐这种方法,它包括使用 7.4 Databricks Runtime 版本和至少 2 个工作人员,然后您将默认安装 python3 和库“密码学”。
You will just need to install simple-salesforce manually from the libraries part, and:您只需要从库部分手动安装 simple-salesforce,并且:
import simple_salesforce
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.