简体   繁体   English

Py2exe; 导入错误没有名为Tweepy的模块

[英]Py2exe; Import Error no module named Tweepy

My python script includes a Qt GUI which I'm trying to convert into a Windows executable using Py2exe. 我的python脚本包含一个Qt GUI,我正尝试使用Py2exe将其转换为Windows可执行文件。 My script is using the Tweepy module to fetch data from Twitter. 我的脚本使用Tweepy模块从Twitter获取数据。 So I include Tweepy and try to compile it into an executable using the following Setup.py: 因此,我包含了Tweepy并尝试使用以下Setup.py将其编译为可执行文件:

from distutils.core import setup
import py2exe

setup(
    windows = [{"script": "main.py"}],
    options = {"py2exe":{"includes":["sip", "tweepy"]}}
    )

The following Error gets raised: 引发以下错误:

raise ImportError, "No module named " + qname
ImportError: No module named tweepy

I've succesfully used the same setup file (minus the 'Tweepy include') to compile other script in the past. 我过去曾成功使用相同的安装文件(减去“ Tweepy包含”)来编译其他脚本。 What am I missing here? 我在这里想念什么?

Assuming that you have tweepy installed in the python installation that you are trying to build with try adding: 假设您尝试使用以下命令构建的python安装中已经安装了tweepy:

import tweepy

near the start of your setup.py to ensure that py2exe can really see it, some packages do some interesting things during import. 为了确保py2exe可以真正看到它,在setup.py开头附近,一些软件包在导入过程中做了一些有趣的事情。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM