简体   繁体   English

pyinstaller:使用 --key 命令时出现问题

[英]pyinstaller: problem when using --key command

I'm trying to use pyinstaller -F --key="123456" my.py to encrypt exe, but got this error instead:我正在尝试使用pyinstaller -F --key="123456" my.py来加密 exe,但得到了这个错误: 在此处输入图像描述

And here is the content of my.py, no extra files or datas needed:这是 my.py 的内容,不需要额外的文件或数据:

import requests
from bs4 import BeautifulSoup


def get_page_source(page_num):
    print('Crawling page %d' % page_num)

    url = 'http://books.toscrape.com/catalogue/page-%d.html' % page_num
    r = requests.get(url)
    return r.text


def get_book_info(page_source):
    soup = BeautifulSoup(page_source, features='lxml')
    titles = soup.select('h3 > a')
    for title in titles:
        print(title.get('title'))


if __name__ == '__main__':
    # 1-50
    for i in range(1, 51):
        page_source = get_page_source(i)
        get_book_info(page_source)

Don't have any clue on how to solve it.不知道如何解决它。 It works fine when I stop using --key command.当我停止使用 --key 命令时它工作正常。

PyInstaller==3.4 Python==3.6 PyInstaller==3.4 Python==3.6

It is known bug and it is because Pyinstaller encryption is not compatible with pycryptodome . 这是已知的错误,这是因为Pyinstaller加密与pycryptodome不兼容。 So you need to install the old PyCrypto to make it work. 因此,您需要安装旧的PyCrypto才能使其正常工作。

There is a good answer in here for installing the old PyCrypto . 这里安装旧的PyCrypto有一个很好的答案。

pip install pycrypto

install: pip install cryptography to solve the problem & for the lates encryption ver of pycrypto.安装: pip install cryptography以解决问题并用于 pycrypto 的最新加密版本。 PyCrypto 2.x is unmaintained, obsolete, and contains security vulnerabilities. PyCrypto 2.x 未维护、已过时且包含安全漏洞。 know more at PyCrypto在 PyCrypto 了解更多信息

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM