我一直在尝试在我的Windows64位笔记本电脑上安装Python包scrypt,因为我想使用的另一个包需要它。同样的包也需要Python3.6,所以在我的电脑上同时安装了Python2.7和3.6,并使用pip和pip3来区分这两者。在执行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上使用Python3.6?
发布于 2017-12-15 02:57:04
根据存储库信息,scrypt包仅适用于预编译形式的Python for Windows 3.5及以下版本。我的猜测是,它在2.7上运行得很好,因为它不会尝试从头开始编译二进制部分,但在3.6上,它必须这样做,并且您没有安装所需的部分。
这种类型的错误是令人沮丧的,但除非包维护者想要为3.6提供一个预先构建的包,否则您将不得不自己努力构建它。
发布于 2018-01-23 19:23:27
按照这里的说明:https://stackoverflow.com/a/39270114/150851
您需要从此处安装OpenSSL-Win64 1.0.2n (不是轻量级版本):
http://slproweb.com/products/Win32OpenSSL.html
然后运行python setup.py install,它应该可以工作。
https://stackoverflow.com/questions/47819916
复制相似问题