为什么PyInstaller没有检测到请求模块?

时间:2016-01-20 20:05:01

标签: python python-3.x python-requests pyinstaller

我使用PyInstaller从我的python 3项目中创建一个.exe文件。

问题是来自.exe文件的错误

  Traceback (most recent call last):
  File "src\parser\bla.py", line 25, in get_b
  File "src\parser\blabla.py", line 32, in __init__
  File "src\parser\blablabla.py", line 9, in get_b_a
AttributeError: module 'requests' has no attribute 'get'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 147, in <module>
  File "<string>", line 141, in main
  File "<string>", line 57, in saving_a
  File "src\parser\bla.py", line 26, in get_a
AttributeError: module 'requests' has no attribute 'exceptions'
main returned -1

我的规格看起来像这样

block_cipher = None

a = Analysis(['main.py'],
             pathex=['F:\\Dropbox\\web development\\prjct', 'C:\\Users\\uzr\\AppData\\Local\\Programs\\Python\\Python35-32\\Lib\\site-packages'],
             binaries=None,
             datas=[ ('F:\\Dropbox\\web development\\prjct\\public\\thingies.txt', 'DATA') ],
             hiddenimports=["requests"],
             hookspath=[],
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
             cipher=block_cipher)
exe = EXE(pyz,
          a.scripts,
          a.binaries,
          a.zipfiles,
          a.datas,
          name='main',
          debug=False,
          strip=False,
          upx=True,
          console=True )

为什么PyInstaller没有正确检测到请求模块? 请求包是2.9.1 PyInstaller 3.1

1 个答案:

答案 0 :(得分:2)

我不能说它是否与您的问题直接相关,但似乎其他人在使用PyInstaller和requests模块时遇到了一些问题:https://github.com/maphew/apt/issues/45