poppyque
poppyque
采纳率50%
2019-01-15 00:32 阅读 6.1k

pyinstaller打包问题ImportError: No module named sip

5
C:\python27\Scripts\pyinstaller\myfile\dist>myfile.exe
Traceback (most recent call last):
  File "pyinstaller\myfile.py", line 2, in <module>
  File "C:\python27\Scripts\pyinstaller\PyInstaller\loader\pyimod03_importers.py", line 684, in load_module
    module = imp.load_module(fullname, fp, filename, ext_tuple)
ImportError: No module named sip
[20104] Failed to execute script myfile
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • tavatimsa tavatimsa 2019-01-15 09:57

    你的引用包问题。识别不出sip模块。

    # 打包py文件需要
    def getExePath():
        sap = '/'
        if sys.argv[0].find(sap) == -1:
            sap = '\\'
        index = sys.argv[0].rfind(sap)
        path = sys.argv[0][:index] + sap
        return path
    
    点赞 评论 复制链接分享