PyCrypto install error on Windows

两盒软妹~` 提交于 2019-11-29 17:05:25

问题


I am trying to install PyCrypto 2.6 Library on my computer. But I keep getting the following error

D:\Software\Python\package\pycrypto-2.6>python setup.py build
running build
running build_py
running build_ext
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.

building 'Crypto.Random.OSRNG.winrandom' extension
error: Unable to find vcvarsall.bat

My System has Windows 8 Pro 64-bit, Visual Studio Enterprise 2012 and Python 3.3

To fix the error I tried to set the Environment Variable VS90COMNTOOLS=%VS110COMNTOOLS% as advised by fmuecke in the post error: Unable to find vcvarsall.bat but it didn't work for me.

Can any one please advise me how to fix this error.

FYI, I don't to install VC2008 etc..


回答1:


I managed to install PyCrypto 2.6 by using the prebuilt binary for Python3.3 from The Voidspace Python Modules.

It doesn't actually fix the error: Unable to find vcvarsall.bat for other package which don't have a prebuilt binaries available.

However it eliminates the need to build PyCrypto package, allowing me to install PyCrypto on my system without getting the error.




回答2:


I know this is an old question, but I also need today much time to get paramiko wokring. I want to use Python 3.4 and on voidspace, there are no prebuild binaries for 3.4.

Finally, I got a wokring pycrypto by installing "Microsoft Studio Express 2010 C++" and run from the pycrypto 2.7 folder:

python setup.py build --compiler msvc
python setup.py install
python setup.py bdist_wininst

All the "tricks" with enviroment variables doesn't work for me.

If it helps somebody, all the thanks goes to: http://flintux.wordpress.com/2014/04/30/pycrypto-for-python-3-4-on-windows-7-64bit/




回答3:


I've just used

https://www.microsoft.com/en-gb/download/details.aspx?id=44266

with setuptools > 6.0 and run

'pip install pycrypto'

and it worked




回答4:


For Python 3.5 you can do this:

Install a PyCrypto binary from this site : https://github.com/sfbahr/PyCrypto-Wheels

The best way to do it, is:

64bits Python

c:\Python35\Scripts\pip.exe install --use-wheel --no-index --find-links=https://github.com/sfbahr/PyCrypto-Wheels/raw/master/pycrypto-2.6.1-cp35-none-win_amd64.whl pycrypto

32bits Python

c:\Python35\Scripts\pip.exe install --use-wheel --no-index --find-links=https://github.com/sfbahr/PyCrypto-Wheels/raw/master/pycrypto-2.6.1-cp35-none-win32.whl pycrypto

Of course replace c:\Python35\Scripts\pip.exe by your python pip path

To know your python version, run python and look at the architecture displayed between brackets:

C:\Users\utilisateur>python Python 3.5.1 |Anaconda 4.0.0 (64-bit)| (default, Feb 16 2016, 09:49:46) [MSC v.1900 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.

Hope this can help.




回答5:


You may install mingw64 and then run from the PyCrypto unzipped files directory:

python setup.py build --compiler=mingw32




回答6:


I am using Windows 10 - All I needed to do was update my system with Visual C++ Build Tools 2015 which I found on this page: https://blogs.msdn.microsoft.com/pythonengineering/2016/04/11/unable-to-find-vcvarsall-bat/

About mid-page, you will see some download options - choose your python version and download the correct package

I then re-imported the program I was trying to install and NO more error! Woohoo!




回答7:


if you are VS 2010

SET VS90COMNTOOLS=%VS100COMNTOOLS%

VS 2012

SET VS90COMNTOOLS=%VS110COMNTOOLS%

VS 2013

SET VS90COMNTOOLS=%VS120COMNTOOLS%

and then python setup.py install




回答8:


got an easy way , hence sharing

  1. download the exe from https://www.dropbox.com/s/fhsvbl6d6ecs303/pycrypto-2.6.1.win-amd64-py3.4.exe?dl=0
  2. run easy_install C:\your\pathToDownloadedFile\Downloads\pycrypto-2.6.1.win-amd64-py3.4.exe


来源:https://stackoverflow.com/questions/13787258/pycrypto-install-error-on-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!