在Python 3中安装createsend时“无法导入名称__version__”

时间:2013-11-08 19:21:36

标签: python python-3.x pip

我创建了一个运行Python 3.3.2的新鲜venv。在尝试通过pip安装Campaign Monitor的createsend包时,它会产生:

  Running setup.py egg_info for package createsend
    Traceback (most recent call last):
      File "<string>", line 16, in <module>
      File "/vagrant/3.3.2venv/build/createsend/setup.py", line 5, in <module>
        from createsend import __version__
      File "./createsend/__init__.py", line 1, in <module>
        from createsend import __version__
    ImportError: cannot import name __version__
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 16, in <module>

  File "/vagrant/3.3.2venv/build/createsend/setup.py", line 5, in <module>

    from createsend import __version__

  File "./createsend/__init__.py", line 1, in <module>

    from createsend import __version__

ImportError: cannot import name __version__

我相信这个包与Python 3兼容。我正在运行最新版本的pip。谁能解释为什么我收到这个错误?

1 个答案:

答案 0 :(得分:3)

version 4.2.0, released 10 Oct, 2016开始,此软件包现在与Python 3兼容。从2013年起,旧的答案如下所示。


不,这个软件包兼容Python 3。它使用相对导入:

    from createsend import __version__
  File "./createsend/__init__.py", line 1, in <module>
    from createsend import __version__

第二个createsend意味着createsend/createsend.py。相反,Python 3将其视为绝对包,并且递归导入无法找到__version__名称。