2016-07-08 12 views
0

これは暗号化モジュールと関係がありますが、わかりません。Python 2.7 'packaging'パッケージが必要です。通常これはこのパッケージにバンドルされています

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という名前のファイルに気づいた、と私は人々がそれで問題が発生したどこかで見ました。フックや何かを編集する必要はありますか?

答えて

0

pyinstallerの最新バージョンで更新されました。現在は動作しています。

0

この

pip uninstall setuptools 
pip install setuptools==19.2 
をお試しください
関連する問題