使用Python 3.6安装Python包scrypt

时间:2017-12-14 18:28:22

标签: python python-3.x scrypt

我一直在尝试在我的Windows 64位笔记本电脑上安装Python软件包scrypt,因为我想要使用的另一个软件包需要它。同样的程序包也需要Python 3.6,因此在我的计算机上我同时拥有Python 2.7和3.6,并使用pippip3来区分这两者。在执行pip install scrypt时,所有内容都安装正常,但在使用pip3 install scrypt时,我收到以下错误:

scrypt-1.2.0/lib/crypto\crypto_scrypt.h(33): fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory

我试过通过克隆存储库来解决这个问题:

$ hg clone http://bitbucket.org/mhallin/py-scrypt
$ cd py-scrypt
$ PATHTOPYTHON3 setup.py build

然后给出以下错误

scrypt-1.2.0/libcperciva/crypto/crypto_aes.c(6): fatal error C1083: Cannot open include file: 'openssl/aes.h': No such file or directory

然后我通过更改setup.py

中的以下代码来解决此错误
elif sys.platform.startswith('win32'):
    define_macros = [('inline', '__inline')]
    libraries = ['libeay32', 'advapi32']
    extra_sources = ['scrypt-windows-stubs/gettimeofday.c']

    if struct.calcsize('P') == 8:
        library_dirs = ['c:\OpenSSL-Win64\lib']
        includes = ['c:\OpenSSL-Win64\include', 'scrypt-windows stubs/include']
    else:
        library_dirs = ['c:\OpenSSL-Win32\lib']
        includes = ['c:\OpenSSL-Win32\include', 'scrypt-windows-stubs/include']

简单地将库设为64位

library_dirs = ['c:\OpenSSL-Win64\lib']
includes = ['c:\OpenSSL-Win64\include', 'scrypt-windows

但这又一次出错:

LINK : fatal error LNK1181: cannot open input file 'libeay32.lib'

在此之后我放弃了来到这里询问该怎么做。如何让scrypt在Windows上使用Python 3.6?

2 个答案:

答案 0 :(得分:0)

根据存储库信息,scrypt包仅适用于预编译形式的Windows版本高达3.5的版本。我的猜测是它在2.7上运行正常,因为它不是试图从头开始编译二进制部分,而是在3.6它必须并且你没有它需要安装的部分。

这种错误令人沮丧,但除非软件包维护者想要为3.6提供预构建的软件包,否则你必须自己构建它。

答案 1 :(得分:0)

根据此处的说明:https://stackoverflow.com/a/39270114/150851

您需要从此处安装OpenSSL-Win64 1.0.2n(不是简易版):

http://slproweb.com/products/Win32OpenSSL.html

然后运行python setup.py install它应该可以。