Py2exe 请求、Clint、LXML

Py2exe requests, Clint, LXML

我的 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 是正确的,但似乎不正确。

有什么想法吗?

使用 pyinstaller 代替 py2exe

Pyinstaller.exe -F script.py

-F表示一个文件

由于您正在使用 请求 可能需要做

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

试一试