Python 2.7'包装'包是必需的;通常这与这个包捆绑在一起

时间:2016-07-08 01:36:43

标签: python cryptography pyinstaller

我希望这与加密模块有关,但我不确定。

Traceback (most recent call last):
  File "<string>", line 11, in <module>
  File "c:\python27\lib\site-packages\PyInstaller-2.1-py2.7.egg\PyInstaller\load
er\pyi_importers.py", line 270, in load_module
    exec(bytecode, module.__dict__)
  File "C:\Python34\Stuff\Encrypt\build\encrypt\out00-PYZ.pyz\pkg_resources", li
ne 68, in <module>
  File "C:\Python34\Stuff\Encrypt\build\encrypt\out00-PYZ.pyz\pkg_resources.exte
rn", line 60, in load_module
ImportError: The 'packaging' package is required; normally this is bundled with
this package so if you get this warning, consult the packager of your distributi
on.

来源:

import os, sys, getpass, time
from cryptography.fernet import Fernet
from tqdm import tqdm
from time import gmtime, strftime
import subprocess
name = getpass.getuser()
print strftime("%Y-%m-%d %I:%M:%S")
print "NOTE: Encrypting will delete all data in either .txt, so please save the data."
print "-------------------------------------------------------------------------------"
def copy2clip(txt):
   cmd='echo '+txt.strip()+'|clip'
   return subprocess.check_call(cmd, shell=True)
def delete():
    try:
        os.remove("key.txt")
        os.remove("Encryption.txt")
    except:
        print "Error, files not deleted."
def encrypt():
    input = raw_input("Please enter what you want to be encrypted: ")
    for i in tqdm(range(100)):
        time.sleep(0.01)
    key = Fernet.generate_key()
    cipher_suite = Fernet(key)
    cipher_text = cipher_suite.encrypt(input)
    plain_text = cipher_suite.decrypt(cipher_text)
    time.sleep(1)
    print "Encryption completed..."
    #save

    f = open("encryption.txt", "w")
    f.write(cipher_text)
    f.close()
    time.sleep(1)
    print "Encryption data saved to encryption.txt and copied to clipboard..."
    copy2clip(cipher_text)

    d = open("key.txt", "w")
    d.write(key + "\n\n")
    d.close()
    time.sleep(1)
    print "Key data saved to key.txt..."
    time.sleep(5)
while True:
    encrypt()
    os.system('cls')
    print strftime("%Y-%m-%d %I:%M:%S")
    print "NOTE: Encrypting will delete all data in either .txt, so please save the data."
    print "-------------------------------------------------------------------------------"

time.sleep(5)

我注意到一个名为cryptography.hazmat.bindings._padding.pyd的文件,我看到人们遇到问题。我需要编辑钩子吗?

2 个答案:

答案 0 :(得分:1)

试试这个

pip uninstall setuptools
pip install setuptools==19.2

答案 1 :(得分:0)

更新了最新版本的pyinstaller,它现在正在运行。