用python3.6安装Python包scrypt

2024-06-03 03:03:47 发布

您现在位置:Python中文网/ 问答频道 /正文

我一直试图在我的Windows 64位笔记本电脑上安装Python包scrypt,因为我想使用的另一个包需要它。同一个包还需要Python3.6,因此在我的计算机上我既有Python2.7也有3.6,并使用pip和{}来区分这两者。当执行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

我尝试通过如下方式克隆存储库来解决此问题:

^{pr2}$

然后给出以下错误

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上使用python3.6?在


Tags: includewindowslib错误libraryerroropencrypto
2条回答

根据存储库信息,scrypt包仅适用于python3.5forwindows的预编译版本。我猜它在2.7上运行得很好,因为它不想从头开始编译二进制部分,但是在3.6上它必须这样做,而且你没有安装它需要的部分。在

这种错误是令人沮丧的,但是除非包维护人员希望为3.6提供一个预构建的包,否则您必须自己构建它。在

按照这里的说明:https://stackoverflow.com/a/39270114/150851

您需要从这里安装OpenSSL-Win64 1.0.2n(不是轻量级版本):

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

然后运行python setup.py install,它应该可以工作了。在

相关问题 更多 >