Python3.4 installation Pycrypto Tips error handling methods

Source: Internet
Author: User
Tags error handling

Today do interface testing, there is an interface parameter using AES encryption, development also provides the implementation of cryptographic functions, but Python2.6 implementation, I am accustomed to use is Python3.4, so prepare to do the next compatibility processing, the results of the process found the installation Pycrypto library will be error.

As a test, to locate the problem and solve the problem is our strength, so took some time to deal with the problem, by the way to make a record of the results, if there are classmates encounter the same problem, do not have to repeat the pit.

Let's look at the command line for my installation library:

python34 -m pip install pycrypto

Here is the error message:

running build_extwarning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.building ‘Crypto.Random.OSRNG.winrandom‘ extensionerror: Microsoft Visual C++ 10.0 is required. Get it with "Microsoft Windows SDK 7.1": www.microsoft.com/download/details.aspx?id=8279

From the error message to see, is the lack of dependent library files, indeed, I installed on the machine is VS2008, because the use of less has not been updated, but the hint is to need VS2010 support, can not be installed a library, I would like to install a much larger VS2010 bar, so:

Method One: Install VS2010, and then set the environment variable

Give up first, really can't find the method to say.

Continue to Google found that students have provided a new solution:

Method Two: Reinstall the Crypto library after uninstalling the Pycrypto

Execute the following command line as required:

python34 -m pip uninstall cryptopython34 -m pip install pycrypto

Errors are still, the error message is a word has not changed, invalid method .

Continue to see other scenarios:

Method Three: Upgrade under Setuptools

I didn't fix it. This has nothing to do with the problem, but the upgrade is no harm, l, in turn, execute the following command line:

python34 -m pip install --upgrade setuptoolspython34 -m pip install pycrypto

Errors are still, the error message is a word has not changed, invalid method .

Eyes looking to go back to find VS2010 installation package, suddenly found someone found this library compiled EXE installation package, like, sure enough or that sentence "There is a demand for the place, someone out of the realization", see if you can get it.

Method Four: Install the Pycrypto compiled EXE installation package

Installation package Address:
Http://www.voidspace.org.uk/python/pycrypto-2.6.1/pycrypto-2.6.1.win32-py3.4.exe

Pro-Test effective, problem solving.

In addition, remember to the Python installation directory \lib\site-packages to see, if the crypto is all lowercase to change to crypto, or the introduction will be error.

Attach the Introduction code:

from Crypto.Cipher import AES

Method operated at:
75039789

Python3.4 installation Pycrypto Tips error handling methods

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.