ImportError: cannot import name MAXREPEAT with cx_Freeze

后端 未结 6 640
梦谈多话
梦谈多话 2020-12-18 21:04

I\'m running into an issue with cx_Freeze when running a frozen application (works fine unfrozen).

When running the program it results in the following

相关标签:
6条回答
  • 2020-12-18 21:38

    I encountered this problem when I just upgraded from ubuntu 12.10 to 13.04, and I fixed this by copying the /usr/bin/python to /path/to/my/env/bin/, and it worked just fine

    cp /user/bin/python /path/to/my/env/bin/

    or, there's a more elegant way to fix this(reference):

    mkvirtualenv <existing virtualenv name>

    0 讨论(0)
  • 2020-12-18 21:43

    If all else fails, I got things running using this: http://www.kiwisoft.co.uk/blog/2014/08/17/fixed-importerror-cannot-import-name-maxrepeat

    0 讨论(0)
  • 2020-12-18 21:48

    _sre is a built in module, so there's no file to include for it, but it doesn't have a MAXREPEAT attribute in Python 2.7.3:

    >>> import _sre
    >>> _sre
    <module '_sre' (built-in)>
    >>> _sre.MAXREPEAT
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    AttributeError: 'module' object has no attribute 'MAXREPEAT'
    

    My best guess is that your frozen copy somehow has the standard library .py modules from Python 2.7.4, but the compiled Python interpreter from 2.7.3 or an earlier version. I see you're working from /usr/local - maybe it's picking up an older version from /usr.

    0 讨论(0)
  • 2020-12-18 21:53

    I was using cx_freeze 4.3.2 on my win 8 machine and it was always showing ImportError: cannot import name MAXREPEAT with cx Freeze if I ever tried to freeze a non built-in module, and once I downloaded version 4.3.1, it works, I'm able to freeze my all python 3.3 programs without any problem now.

    0 讨论(0)
  • 2020-12-18 22:00

    I was having similar issues on windows 8 - was just a PYTHONPATH issue. check that PYTHONPATH exists by typing the following into a python session:

    import os

    os.environ['PYTHONPATH'].split(os.pathsep)

    if you get an error set your PYTHONPATH using this approach..

    How to add to the pythonpath in windows 7?

    0 讨论(0)
  • 2020-12-18 22:02

    I had the same problem recently. Setting LD_LIBRARY_PATH= solved the problem.

    0 讨论(0)
提交回复
热议问题