【问题标题】:Installing Python package scrypt with Python 3.6使用 Python 3.6 安装 Python 包 scrypt
【发布时间】:2018-05-28 22:19:39
【问题描述】:

我一直在尝试在我的 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?

【问题讨论】:

    标签: python python-3.x scrypt


    【解决方案1】:

    根据存储库信息,scrypt 包仅可用于预编译形式的 Windows 3.5 以下版本的 Python。我的猜测是它在 2.7 上可以正常工作,因为它不会尝试从头开始编译二进制部分,但在 3.6 上它必须这样做并且您没有安装它需要的部分。

    这种错误令人沮丧,但除非包维护者想要为 3.6 提供预构建的包,否则您将不得不自己构建它。

    【讨论】:

      【解决方案2】:

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

      你需要从这里安装OpenSSL-Win64 1.0.2n(不是精简版):

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

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2017-07-11
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2018-10-15
        • 1970-01-01
        • 2017-05-22
        相关资源
        最近更新 更多