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

有些话、适合烂在心里 提交于 2019-11-29 11:06:17

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.

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

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

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.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!