安装在anaconda(smtplib)中不可用的python包

问题描述:

我在linux上使用anaconda,我想安装 smtplib 发送邮件。
我尝试过,

I'm using anaconda on linux and I want to install smtplib to send mail. I have tried,

conda install smtplib 返回:

PackageNotFoundError:当前linux-64通道中缺少的软件包:
- smtplib

pip install smtplib 返回:

没有找到满足要求的版本smtplib(从版本:)
找不到匹配的smtplib发行版

我发现 smtplib 默认情况下,在标准的python发行版中,我想知道为什么它不能在anaconda中使用。

I found that smtplib comes by default in the standard python distribution and I wonder why it is not available in anaconda.

问题:如何安装smtplib?或者更一般地说,如何安装不包含在anaconda中的包?

Question: How to install smtplib? Or more generically, how to install a package that is not included in anaconda?

还有类似的问题这里这里,但没有任何答案。

There are similar questions here and here but without any answers.

规格 Python 2.7.13 | Anaconda 4.3.1(64位)| (默认,2016年12月20日,23:09:15)
[GCC 4.4.7 20120313(Red Hat 4.4.7-1)] on linux2

首先,真实环境管理器是 conda anaconda 实际上是用于科学计算的常用软件包的集合,因此创建环境不需要。

First, the real environment manager is conda, and anaconda is actually a collection of generally used packages for scientific calculation, so it is not necessary for creating an environment.

其次, smtplib 是一个用于python2.7和python3.x的内置包,所以有不需要安装。您可以导入它,而无需安装任何其他软件包。

Second, smtplib is a built-in package for both python2.7 and python3.x, so there is no need for installation. You can import it without installing any other package.

最后,什么源激活< venv name> 是修改当前控制台中的环境变量。这也意味着更改命令 python pip 的路径以及python程序查找已安装模块的路径。一句话, source activate< venv name> 为python激活一个独立的环境。

Finally, what source activate <venv name> real does is that modify your environment variables in the current console. That also means change the path of command python and pip and the path where python program looks for installed modules. In a word, source activate <venv name> activate a separated environment for python.