开发者

python 3.2: cx_freeze does not import all of pyserial

I am having issues building an exe verision of my python 3.2 script. The script requires pyserial and builds using cx_freeze. However, when I run the exe I get:

Traceback (most recent call last):
File "C:\Python32\lib\site-packages\开发者_如何转开发cx_Freeze\initscripts\Console3.py", line 27,
in   <module>
  exec(code, m.__dict__)
File "my_serial_program.py", line 1, in <module>
  import serial
File "C:\Python32\lib\site-packages\serial\__init__.py", line 19, in <module>
  from .serialwin32  import *
File "C:\Python32\lib\site-packages\serial\serialwin32.py", line 12, in <module>
  from . import win32
ImportError: cannot import name win32

Doing a little snooping, Pyserial site-package has a "win32.py" module (in addition to serialwin32.py); however, in the compressed lib that cx_freeze produces, win32.py is missing. Simply placing a pyc version does not fix the issue. Also using cx_freeze "includes = [ ]" does not work.

Any ideas? Is my question even cogent (I am fairly new to python)?


I had the same issue. There is an option to include extra modules as mentioned in cx_Freeze ImportError: cannot import name and documentation for cx_Freeze

Just append --include-modules serial.win32

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜