本文介绍了pip在安装pyzmail时失败,错误代码为1的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试通过python3发送Gmail.我可以使用emailsmptlib,但是我想尝试pyzmail.

I'm trying to send Gmail through python3. I can use the email and smptlib, but I wanted to try out pyzmail.

但是,当我尝试安装pyzmail时,我得到了:

However, when I try to install pyzmail, I get this:

$ pip3 install pyzmail
Collecting pyzmail
  Using cached https://files.pythonhosted.org/packages/23/9a/c8709821fa15cec44f825fba884284b261a06d8a0033a16f4c35470eb26a/pyzmail-1.0.3.tar.gz
Collecting distribute (from pyzmail)
  Using cached https://files.pythonhosted.org/packages/5f/ad/1fde06877a8d7d5c9b60eff7de2d452f639916ae1d48f0b8f97bf97e570a/distribute-0.7.3.zip
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/private/var/folders/8r/50c4fq6j70q0qmhvwxvr00fw0000gn/T/pip-install-v4ervkb7/distribute/setuptools/__init__.py", line 2, in <module>
    from setuptools.extension import Extension, Library
  File "/private/var/folders/8r/50c4fq6j70q0qmhvwxvr00fw0000gn/T/pip-install-v4ervkb7/distribute/setuptools/extension.py", line 5, in <module>
    from setuptools.dist import _get_unpatched
  File "/private/var/folders/8r/50c4fq6j70q0qmhvwxvr00fw0000gn/T/pip-install-v4ervkb7/distribute/setuptools/dist.py", line 7, in <module>
    from setuptools.command.install import install
  File "/private/var/folders/8r/50c4fq6j70q0qmhvwxvr00fw0000gn/T/pip-install-v4ervkb7/distribute/setuptools/command/__init__.py", line 8, in <module>
    from setuptools.command import install_scripts
  File "/private/var/folders/8r/50c4fq6j70q0qmhvwxvr00fw0000gn/T/pip-install-v4ervkb7/distribute/setuptools/command/install_scripts.py", line 3, in <module>
    from pkg_resources import Distribution, PathMetadata, ensure_directory
  File "/private/var/folders/8r/50c4fq6j70q0qmhvwxvr00fw0000gn/T/pip-install-v4ervkb7/distribute/pkg_resources.py", line 1518, in <module>
    register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/8r/50c4fq6j70q0qmhvwxvr00fw0000gn/T/pip-install-v4ervkb7/distribute/

我测试了安装其他pip模块,但似乎一切正常.

I tested installing a different pip module but everything seemed to be in order.

我也尝试过easy_install,但它是为python 2.7而不是3安装的.

I also tried easy_install but it installed for python 2.7, and not 3.

我认为这可能与我的设置工具有关,但我不知道需要做什么.

I think it might be something about my setuptools, but I don't know what needs to be done.

推荐答案

由于pyzmail软件包现在似乎处于非活动状态rel ="nofollow noreferrer">最后提交最新版本 4年前.它似乎没有针对Python 3.6及更高版本进行更新.

The pyzmail packages seems to be inactive now as the last commit and the last release were made 4 years ago. It does not seem to be updated for Python 3.6+.

该软件包的github页面上发布了一个与您相同的错误的问题: https: //github.com/aspineux/pyzmail/issues/15 .有人发布了补丁程序来解决此问题,但是最好的解决方案是改用pyzmail36

There was an issue posted on the package's github page with the same error as yours: https://github.com/aspineux/pyzmail/issues/15. Someone posted a patch as a workaround but the best solution is to use pyzmail36 instead:

不幸的是,此存储库似乎不活动,因此我创建了一个新的 包含所有修补程序的pyzmail包 可在Python 3.6上pip安装.

This repository unfortunately seems inactive, so I created a new package on PyPI that includes all the fixes to make pyzmail pip-installable on Python 3.6.

新软件包的名称为 pyzmail36 .您可以更新您的 requirements.txt文件列出pyzmail36而不是pyzmail和所有 您的其余代码无需更改.

The name of the new package is pyzmail36. You can just update your requirements.txt file to list pyzmail36 instead of pyzmail and all of the rest of your code shouldn't need to change.

所以只需尝试:

pip3 install pyzmail36

这篇关于pip在安装pyzmail时失败,错误代码为1的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 17:57