【问题标题】:Py2exe requests, Clint, LXMLPy2exe 请求、Clint、LXML
【发布时间】:2015-07-22 10:58:02
【问题描述】:

我的 setup.py 在尝试制作我的 py2exe 安装脚本时抛出以下错误

The following modules appear to be missing
['OpenSSL.SSL', '_scproxy', 'backports.ssl_match_hostname', 'builtins', 'certifi', 'clint.textui.puts', 'http', 'http.client', 'http.cookies', 'ndg.httpsclient.ssl_peer_verification', 'ndg.httpsclient.subj_alt_
name', 'packages.ssl_match_hostname.CertificateError', 'packages.ssl_match_hostname.match_hostname', 'packages.urllib3.Retry', 'packages.urllib3.util.Timeout', 'packages.urllib3.util.parse_url', 'pyasn1.codec.d

我的 setup.py 中缺少什么,所以它可以工作?

from setuptools import setup
from sys import version

try:
    import py2exe
except ImportError:
    print "Warning: py2exe is not installed."
    print "(Though it may not be available on your platform.)"

requires = ['requests', 'clint', 'lxml']
if version < '2.6.0':
    requires.append("simplejson")

setup(
    name='CFSRESD',
    version='0.1',
    author='Shane Rees',
    url='http://github.com/Shaggs/cfsresd',
    options=dict(py2exe=dict(includes=['scraper'])),

    requires= requires,
    license='GPL3',
    console=['daemon.py']
    )

这是我的 daemon.py 脚本的顶部

from scraper import Scraper
import sys
import requests
from clint.textui import puts, colored

我认为我的 setup.py 是正确的,但似乎不正确。

有什么想法吗?

【问题讨论】:

    标签: python-2.7 lxml python-requests py2exe clint


    【解决方案1】:

    使用 pyinstaller 代替 py2exe

    Pyinstaller.exe -F script.py
    

    -F 表示一个文件

    既然你在使用请求可能不得不做

    pyinstaller.exe -F --hidden-import=requests script.py
    

    试一试

    【讨论】:

      猜你喜欢
      • 2011-07-15
      • 2013-02-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多