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

Python 2.7 The 'packaging' package is required; normally this is bundled with this package

我想这与密码模块有关,但我不确定。

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 的文件,我看到有人在使用它时遇到问题。我需要编辑钩子什么的吗?

已更新最新版本的 pyinstaller,现在可以使用了。

试试这个

pip uninstall setuptools
pip install setuptools==19.2