如何在ubuntu os中安装python smtplib模块

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31796174/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 10:32:37  来源:igfitidea点击:

How to install python smtplib module in ubuntu os

pythonmodulesmtplib

提问by vijay

I tried to install python module via pip, but it was not successful. can any one help me to install smtplib python module in ubuntu 12.10 OS?

我尝试通过 pip 安装 python 模块,但没有成功。有人可以帮我在 ubuntu 12.10 操作系统中安装 smtplib python 模块吗?

回答by Tahseen

I will tell you a probable why you might be getting error like Error no module smtplib

我会告诉你一个可能的原因,你可能会收到像 Error no module smtplib 这样的错误

I had created program as email.py

我已经创建了作为 email.py 的程序

Now email is a module in python and because of that it start giving error for smtplib also

现在电子邮件是 python 中的一个模块,因此它也开始为 smtplib 提供错误

then I had to delete email.pyc file created and then rename email.py to mymail.py

然后我不得不删除创建的 email.pyc 文件,然后将 email.py 重命名为 mymail.py

After that no error of smtplib

之后smtplib没有错误

Make sure your file name is not conflicting with the python module. Also see because of that any *.pyc file created inside the folder

确保您的文件名与 python 模块不冲突。也看到因为在文件夹内创建的任何 *.pyc 文件

回答by Solar.gy

smptlibis part of python's standard library, so you do not have to install it.

smptlibpython 标准库的一部分,所以你不必安装它。

回答by Nafi Shahriyar

For Linux based distro, it is easy to install from source. Just download the source code from here, extract it and open in a terminal. Now sudo python3 setup.py installInstallation should be complete in seconds

对于基于 Linux 的发行版,从源代码安装很容易。只需从这里下载源代码,解压并在终端中打开。现在sudo python3 setup.py install安装应该在几秒钟内完成