小编Ner*_*tix的帖子

py2exe以下模块似乎缺失

正如标题所说,当我尝试使用py2exe创建Windows可执行文件时,我收到此错误:

The following modules appear to be missing
['Carbon', 'Carbon.Files', 'ElementC14N', 'OpenSSL.SSL', '_frozen_importlib', '_imp', '_scproxy', '_sysconfigdata', 'backports.ssl_match_hostname', 'builtins', 'certifi', 'charade.universaldetector', 'configparser', 'datrie', 'genshi.core', 'html', 'html.entities', 'html.parser', 'http', 'http.client', 'http.cookies', 'http.server', 'importlib.machinery', 'importlib.util', 'ipaddr', 'ipaddress', 'java', 'lzma', 'ndg.httpsclient.ssl_peer_verification', 'ndg.httpsclient.subj_alt_name', 'netbios', 'ordereddict', 'org.python.modules.posix.PosixModule', 'packages.six.moves', 'packages.ssl_match_hostname.CertificateError', 'packages.ssl_match_hostname.match_hostname', 'packages.urllib3.util.Timeout', 'packages.urllib3.util.parse_url', 'packaging.specifiers', 'packaging.version', 'parsers.process', 'pip._vendor.six.moves.urllib', 'pyasn1.codec.der', 'pyasn1.type', 'queue', 'redis', 'reprlib', 'serializer.serialize', 'setuptools_svn', 'simplejson', 'sitecustomize', 'treebuilders.getTreeBuilder', 'treewalkers.getTreeWalker', 'trie.Trie', 'urllib.error', 'urllib.parse', 'urllib.request', 'urllib3', 'usercustomize', 'win32com.client.gencache', 'win32evtlog', 'win32evtlogutil', 'win32pipe', 'win32wnet', 'wincertstore', 'winreg', 'xmlrpc.client']

*** binary dependencies ***
Your …
Run Code Online (Sandbox Code Playgroud)

python executable exe py2exe

7
推荐指数
1
解决办法
1509
查看次数

在函数中定义全局

是否可以在函数内定义全局变量?像这样:

def posities():
    global blauw
    blauw = {"bl1":[0], "bl2":[0],"bl3":[0],"bl4":[0]}
    global geel
    geel = {"ge1":[0], "ge2":[0],"ge3":[0],"ge4":[0]}
    global groen
    groen = {"gr1":[0], "gr2":[0],"gr3":[0],"gr4":[0]}
    global rood
    rood = {"ro1":[0], "ro2":[0],"ro3":[0],"ro4":[0]}
    global ingenomenPos
    ingenomenPos = []
Run Code Online (Sandbox Code Playgroud)

或者我必须首先声明函数之外的变量?因为当我在函数内部定义它们并尝试从另一个函数访问它们时,它无法识别它.所以我想声明全局变量而不先在函数外声明它们.

所以我尝试用这种方法访问那些全局变量:

def bezet():
    print (str(ingenomenPos))
Run Code Online (Sandbox Code Playgroud)

这导致错误:

NameError: name 'ingenomenPos' is not defined
Run Code Online (Sandbox Code Playgroud)

python variables global function

2
推荐指数
1
解决办法
60
查看次数

标签 统计

python ×2

exe ×1

executable ×1

function ×1

global ×1

py2exe ×1

variables ×1