程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

Proper posture of Python + pycrypto encryption module

編輯:Python

Knowledge point 1 :python3.6.2 Version installed pycrypto modular 【 No installation required Visual Studio】

step1: First, download the file shown in the following figure to the local :

Put this whl After the file is downloaded successfully , Place in directory :D:\python\python3.6.2\Scripts Next 【 This is my local python The installation directory , In the process of actual operation , Replace with your own local python The installation directory of 】

step2

cmd Command to enter :D:\python\python3.6.2\Scripts Under the table of contents

Enter the command :pip install pycrypto-2.6.1-cp36-cp36m-win_amd64.whl

If appear :Successfully installed pycrypto-2.6.1 Description installation successful

step3

take site-packages Under bag crypto It is amended as follows :Crypto

step4

If it runs incorrectly :ModuleNotFoundError: No module named ‘winrandom’

In the catalog :D:\python\python3.6.2\Lib\site-packages\Crypto\Random\OSRNG modify nt.py file , take import winrandom It is amended as follows :from . import winrandom that will do

Knowledge point two :Linux and Windows Next :Python Crypto Differences in module installation methods

During the test , It may be necessary to linux and windows Environment crypto Module installation , The environment is different ,linux And windows The environment installation steps will also vary , The second point of knowledge is specialized in crypto Combination of modules python Use in linux And windows Explanation of the differences between environmental installation methods

One 、Linux In the environment :

from Crypto.Signature import PKCS1_v1_5

If there is an error in the guide package :

ImportError: No module named 'Crypto.Signature'

ImportError: No module named 'Crypto'

resolvent :

step1、pip install crypto

step2、 After successful installation , take crypto Change the name to :Crypto

step3、 pip3 install pycryptodome 

Fast way :pip3 install -i https://pypi.douban.com/simple pycryptodome

PyCrypto Is dead , Please replace with PyCryptodome 

pip3 install modular –upgrade –target=” Specified directory ”

The third step is to linux perform :

pip3 install pycryptodome perhaps

Fast way :pip3 install -i https://pypi.douban.com/simple pycryptodome

 step4、 stay linux In the environment , Input python3

>>>from Crypto.Signature import PKCS1_v1_5

If no error is reported , Description installation takes effect , The error reported by this guide package has been solved

  Two 、Windows In the environment :

step1

Put this whl After the file is downloaded successfully , Place in directory :D:\python\python3.6.2\Scripts Next

step2

cmd Command to enter :D:\python\python3.6.2\Scripts Under the table of contents

Enter the command :pip install pycrypto-2.6.1-cp36-cp36m-win_amd64.whl

If appear :Successfully installed pycrypto-2.6.1 Description installation successful

step3

take site-packages Under bag crypto It is amended as follows :Crypto

step4

If it runs incorrectly :ModuleNotFoundError: No module named ‘winrandom’

In the catalog :D:\python\python3.6.2\Lib\site-packages\Crypto\Random\OSRNG modify nt.py file , take import winrandom It is amended as follows :from . import winrandom that will do

Welcome to your attention 【 The way of immeasurable testing 】 official account , reply 【 Claim resources 】

Python+Unittest frame API automation 、

Python+Unittest frame API automation 、

Python+Pytest frame API automation 、

Python+Pandas+Pyecharts Big data analysis 、

Python+Selenium frame Web Of UI automation 、

Python+Appium frame APP Of UI automation 、

Python Programming learning resources dry goods 、

Vue Front end component framework development 、

Resources and code Free ~
Below the official account is two-dimensional code. , You can directly scan wechat and pay attention .

remarks : My official account has been officially opened. , betake IT Sharing of Internet technology .

contain : Data analysis 、 big data 、 machine learning 、 Test Development 、API Interface automation 、 Test operation and maintenance 、UI automation 、 Performance testing 、 code detection 、 Programming technology, etc .

WeChat search official account :“ The way of immeasurable testing ”, Or scan the qr code below :

  

  Add the attention , Let's grow together !


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved