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

标签 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 安装程序 3.1

最佳答案

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

关于python - 为什么 PyInstaller 没有检测到请求模块?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34909458/

相关文章:

python - 从 crontab 运行 python 脚本

javascript - 从 Javascript 命令运行 Django 函数

python - 在 python 3 中使用 boto

python - 如何让 venv 安装 python3.6 二进制文件?

python - 如何为Python 3.1 ubuntu服务器10.04安装请求​​模块?

python - pandas 根据另一列中的序列重复创建类别列

python - 如何在Python中找到真阳性、真阴性、假阳性、假阴性

python - 词典列表,如何获取 : intersection based on one value and symmetric difference based on another value

python - 为什么不同的设备在 Django 中使用相同的 session ?

python - 转换简单的Python请求将POST转换为Rust reqwest