1

尝试制作我的 py2exe 安装脚本时,我的 setup.py 引发以下错误

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

有任何想法吗 ?

4

1 回答 1

1

而不是 py2exe 使用 pyinstaller

Pyinstaller.exe -F script.py

-F表示一个文件

由于您使用requests可能必须做

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

试一试

于 2015-07-30T05:10:06.767 回答