ImportError: No module named 'queue' while running my app freezed with cx_freeze

后端 未结 4 2112
温柔的废话
温柔的废话 2020-12-11 04:52

I am using python 3.4. I am able to run my python script without any problem. But While running my freezed python script , following error have appeared. I am able to freez

相关标签:
4条回答
  • 2020-12-11 04:58

    There are Several options based on project packages:

    Method1:

    Answer: I solve the problem my issue was I had file named queue.py in the same directory

    Method2: Queue is in the multiprocessing module so:

    from multiprocessing import Queue
    

    Method3: Updating pip from 1.5.6 to 8.1.2

    `sudo python -m pip install -U pip`
    

    Reboot system (don't know if necessary, but only after reboot new version of pip was listed) Method4:

    from six.moves.queue import Queue //I don't know how u import six package

    0 讨论(0)
  • 2020-12-11 05:06

    I had the same issues running on Ubuntu with Python 3.5. It seems that cx_freeze has problems with libraries that import other files or something like that.

    Importing Queue together with requests worked for me, so:

    import requests
    from multiprocessing import Queue
    

    And I don't think specifying urllib in "packages": ["urllib", "requests"] is necessary.

    0 讨论(0)
  • 2020-12-11 05:10

    In addition to

    from multiprocessing import Queue
    

    I rolled back to the older version of cx_freeze:

    pip install cx-freeze==4.3.3
    

    Besides, the "requests" library complained on absence of "urllib3" module. I upgraded this to requests==2.13.0 and all now works.

    I'm using Python 3.4 on Win10. Hope this will help.

    0 讨论(0)
  • 2020-12-11 05:13

    In setup.py, options={"build_exe": {"packages": ["multiprocessing"]}} can also do the trick.

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