无法在Python2.7上安装SCYPT



我无法让pip install scrypt工作,在阅读了一些回合之后,我尝试安装Visual Studio 2017,但我尝试从Windows编译器

mingw-w64是一种替代C/C 编译器,可与所有Python版本一起使用,最高为3.4。

Install Win-builds into C:MinGW_w64.
Open Win-builds, switch to install at least binutils, gcc, gcc-g++, getext, mingw-w64, win-iconv, winpthreads, zlib, and click Process.
Add C:MinGW_w64bin to the PATH environment variable.
Create a distutils.cfg file with the following contents in the folder Libdistutils in Python install directory : 
[build] compiler=mingw32
[build_ext] compiler=mingw32

产生了这个新错误,

Running setup.py install for scrypt ... error
    Complete output from command c:python27python.exe -u -c "import setuptools, tokenize;__file__='c:\users\never\appdata\local\temp\pip-install-0ssspt\scrypt\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:usersneverappdatalocaltemppip-record-uncdtbinstall-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating buildlib.win-amd64-2.7
    copying scrypt.py -> buildlib.win-amd64-2.7
    running build_ext
    building '_scrypt' extension
    creating buildtemp.win-amd64-2.7
    creating buildtemp.win-amd64-2.7Release
    creating buildtemp.win-amd64-2.7Releasesrc
    creating buildtemp.win-amd64-2.7Releasescrypt-1.1.6
    creating buildtemp.win-amd64-2.7Releasescrypt-1.1.6lib
    creating buildtemp.win-amd64-2.7Releasescrypt-1.1.6libcrypto
    creating buildtemp.win-amd64-2.7Releasescrypt-1.1.6libscryptenc
    creating buildtemp.win-amd64-2.7Releasescrypt-1.1.6libutil
    C:MinGW_w64bingcc.exe -mdll -O -Wall -DHAVE_CONFIG_H -Iscrypt-1.1.6 -Iscrypt-1.1.6/lib -Iscrypt-1.1.6/lib/scryptenc -Iscrypt-1.1.6/lib/crypto -Iscrypt-1.1.6/lib/util -Ic:OpenSSL-Win32include -Ic:python27include -Ic:python27PC -c src/scrypt.c -o buildtemp.win-amd64-2.7Releasesrcscrypt.o
    C:MinGW_w64bingcc.exe -mdll -O -Wall -DHAVE_CONFIG_H -Iscrypt-1.1.6 -Iscrypt-1.1.6/lib -Iscrypt-1.1.6/lib/scryptenc -Iscrypt-1.1.6/lib/crypto -Iscrypt-1.1.6/lib/util -Ic:OpenSSL-Win32include -Ic:python27include -Ic:python27PC -c scrypt-1.1.6/lib/crypto/crypto_aesctr.c -o buildtemp.win-amd64-2.7Releasescrypt-1.1.6libcryptocrypto_aesctr.o
    C:MinGW_w64bingcc.exe -mdll -O -Wall -DHAVE_CONFIG_H -Iscrypt-1.1.6 -Iscrypt-1.1.6/lib -Iscrypt-1.1.6/lib/scryptenc -Iscrypt-1.1.6/lib/crypto -Iscrypt-1.1.6/lib/util -Ic:OpenSSL-Win32include -Ic:python27include -Ic:python27PC -c scrypt-1.1.6/lib/crypto/crypto_scrypt-nosse.c -o buildtemp.win-amd64-2.7Releasescrypt-1.1.6libcryptocrypto_scrypt-nosse.o
    C:MinGW_w64bingcc.exe -mdll -O -Wall -DHAVE_CONFIG_H -Iscrypt-1.1.6 -Iscrypt-1.1.6/lib -Iscrypt-1.1.6/lib/scryptenc -Iscrypt-1.1.6/lib/crypto -Iscrypt-1.1.6/lib/util -Ic:OpenSSL-Win32include -Ic:python27include -Ic:python27PC -c scrypt-1.1.6/lib/crypto/sha256.c -o buildtemp.win-amd64-2.7Releasescrypt-1.1.6libcryptosha256.o
    C:MinGW_w64bingcc.exe -mdll -O -Wall -DHAVE_CONFIG_H -Iscrypt-1.1.6 -Iscrypt-1.1.6/lib -Iscrypt-1.1.6/lib/scryptenc -Iscrypt-1.1.6/lib/crypto -Iscrypt-1.1.6/lib/util -Ic:OpenSSL-Win32include -Ic:python27include -Ic:python27PC -c scrypt-1.1.6/lib/scryptenc/scryptenc.c -o buildtemp.win-amd64-2.7Releasescrypt-1.1.6libscryptencscryptenc.o
    scrypt-1.1.6/lib/scryptenc/scryptenc.c: In function 'getsalt':
    scrypt-1.1.6/lib/scryptenc/scryptenc.c:214:4: warning: format '%x' expects argument of type 'unsigned int', but argument 2 has type 'DWORD' [-Wformat=]
        printf("%x", error);
        ^
    scrypt-1.1.6/lib/scryptenc/scryptenc.c:170:9: warning: unused variable 'buflen' [-Wunused-variable]
      size_t buflen = 32;
             ^
    scrypt-1.1.6/lib/scryptenc/scryptenc.c:168:10: warning: unused variable 'lenread' [-Wunused-variable]
      ssize_t lenread;
              ^
    scrypt-1.1.6/lib/scryptenc/scryptenc.c:167:6: warning: unused variable 'fd' [-Wunused-variable]
      int fd;
          ^
    C:MinGW_w64bingcc.exe -mdll -O -Wall -DHAVE_CONFIG_H -Iscrypt-1.1.6 -Iscrypt-1.1.6/lib -Iscrypt-1.1.6/lib/scryptenc -Iscrypt-1.1.6/lib/crypto -Iscrypt-1.1.6/lib/util -Ic:OpenSSL-Win32include -Ic:python27include -Ic:python27PC -c scrypt-1.1.6/lib/scryptenc/scryptenc_cpuperf.c -o buildtemp.win-amd64-2.7Releasescrypt-1.1.6libscryptencscryptenc_cpuperf.o
    scrypt-1.1.6/lib/scryptenc/scryptenc_cpuperf.c:42:8: error: redefinition of 'struct timespec'
     struct timespec {
            ^
    In file included from c:mingw_w64x86_64-w64-mingw32includetime.h:277:0,
                     from c:mingw_w64x86_64-w64-mingw32includesystime.h:10,
                     from scrypt-1.1.6/lib/scryptenc/scryptenc_cpuperf.c:31:
    c:mingw_w64x86_64-w64-mingw32includesystimeb.h:90:8: note: originally defined here
     struct timespec {
            ^
    error: command 'C:\MinGW_w64\bin\gcc.exe' failed with exit status 1
    ----------------------------------------
Command "c:python27python.exe -u -c "import setuptools, tokenize;__file__='c:\users\never\appdata\local\temp\pip-install-0ssspt\scrypt\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __file__, 'exec'))" install --record c:usersneverappdatalocaltemppip-record-uncdtbinstall-record.txt --single-version-externally-managed --compile" failed with error code 1 in c:usersneverappdatalocaltemppip-install-0sssptscrypt

任何人都对我下一步该做什么有任何想法,我有些迷失了。

编辑

我尝试了arnav poddar的建议,我得到了:

PS C:> python -m easy_install scrypt
Searching for scrypt
Reading https://pypi.org/simple/scrypt/
Downloading https://files.pythonhosted.org/packages/80/3d/141eb80e754b86f6c25a2ffaf6c3af3acdb65a3e3700829a05ab0c5d965d/scrypt-0.8.13.tar.gz#sha256=1377b1adc98c4152694bf5d7e93b41a9d2e9060af69b747cfad8c93ac426f9ea
Best match: scrypt 0.8.13
Processing scrypt-0.8.13.tar.gz
Writing c:usersneverappdatalocaltempeasy_install-vjtgijscrypt-0.8.13setup.cfg
Running scrypt-0.8.13setup.py -q bdist_egg --dist-dir c:usersneverappdatalocaltempeasy_install-vjtgijscrypt-0.8.13egg-dist-tmp-knuekj
no previously-included directories found matching 'build'
no previously-included directories found matching 'docbuild'
no previously-included directories found matching '*__pycache__'
warning: no previously-included files matching '*.py[cod]' found anywhere in distribution
warning: no previously-included files matching '*.egg' found anywhere in distribution
warning: no previously-included files matching '*.egg-info' found anywhere in distribution
warning: no previously-included files matching '*~' found anywhere in distribution
warning: no previously-included files matching '*.bak' found anywhere in distribution
warning: no previously-included files matching '*.swp' found anywhere in distribution
In file included from scrypt-1.2.1/lib/scryptenc/scryptenc.h:32:0,
                 from src/scrypt.c:30:
scrypt-windows-stubs/include/stdint.h:33:2: error: #error "Use this header only with Microsoft Visual C++ compilers!"
 #error "Use this header only with Microsoft Visual C++ compilers!"
  ^
In file included from scrypt-1.2.1/lib/crypto/crypto_scrypt.h:32:0,
                 from src/scrypt.c:31:
scrypt-windows-stubs/include/stdint.h:33:2: error: #error "Use this header only with Microsoft Visual C++ compilers!"
 #error "Use this header only with Microsoft Visual C++ compilers!"
  ^
In file included from scrypt-1.2.1/lib/crypto/crypto_scrypt.h:33:0,
                 from src/scrypt.c:31:
scrypt-windows-stubs/include/unistd.h:39:27: error: conflicting types for 'int8_t'
 typedef __int8            int8_t;
                           ^
In file included from scrypt-1.2.1/lib/scryptenc/scryptenc.h:32:0,
                 from src/scrypt.c:30:
scrypt-windows-stubs/include/stdint.h:75:30: note: previous declaration of 'int8_t' was here
    typedef signed char       int8_t;
                              ^
error: Setup script exited with error: command 'C:\MinGW_w64\bin\gcc.exe' failed with exit status 1

我删除了distutils.cfg并再次运行:

PS C:Python27Libdistutils> python -m easy_install scrypt
Searching for scrypt
Reading https://pypi.org/simple/scrypt/
Downloading https://files.pythonhosted.org/packages/80/3d/141eb80e754b86f6c25a2ffaf6c3af3acdb65a3e3700829a05ab0c5d965d/scrypt-0.8.13.tar.gz#sha256=1377b1adc98c4152694bf5d7e93b41a9d2e9060af69b747cfad8c93ac426f9ea
Best match: scrypt 0.8.13
Processing scrypt-0.8.13.tar.gz
Writing c:usersneverappdatalocaltempeasy_install-uvqac3scrypt-0.8.13setup.cfg
Running scrypt-0.8.13setup.py -q bdist_egg --dist-dir c:usersneverappdatalocaltempeasy_install-uvqac3scrypt-0.8.13egg-dist-tmp-4u7_4h
no previously-included directories found matching 'build'
no previously-included directories found matching 'docbuild'
no previously-included directories found matching '*__pycache__'
warning: no previously-included files matching '*.py[cod]' found anywhere in distribution
warning: no previously-included files matching '*.egg' found anywhere in distribution
warning: no previously-included files matching '*.egg-info' found anywhere in distribution
warning: no previously-included files matching '*~' found anywhere in distribution
warning: no previously-included files matching '*.bak' found anywhere in distribution
warning: no previously-included files matching '*.swp' found anywhere in distribution
scrypt.c
crypto_scrypt_smix_sse2.c
crypto_scrypt_smix.c
crypto_scrypt.c
scryptenc.c
scrypt-1.2.1/lib/scryptenc/scryptenc.c(125) : warning C4244: '=' : conversion from 'size_t' to 'double', possible loss of data
scryptenc_cpuperf.c
memlimit.c
sha256.c
crypto_aes_aesni.c
crypto_aes.c
crypto_aesctr.c
crypto_entropy.c
entropy.c
scrypt-1.2.1/libcperciva/util/entropy.c(32) : warning C4101: 'lenread' : unreferenced local variable
scrypt-1.2.1/libcperciva/util/entropy.c(31) : warning C4101: 'fd' : unreferenced local variable
insecure_memzero.c
warnp.c
scrypt-1.2.1/libcperciva/util/warnp.c(39) : warning C4996: 'strdup': The POSIX name for this item is deprecated. Instead, use the ISO C++ conformant name: _strdup. See online help for details.
        C:UsersNeverAppDataLocalProgramsCommonMicrosoftVisual C++ for Python9.0VCIncludestring.h(207) : see declaration of 'strdup'
scrypt-1.2.1/libcperciva/util/warnp.c(59) : warning C4996: 'strerror': This function or variable may be unsafe. Consider using strerror_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
        C:UsersNeverAppDataLocalProgramsCommonMicrosoftVisual C++ for Python9.0VCIncludestring.h(126) : see declaration of 'strerror'
humansize.c
asprintf.c
scrypt-1.2.1/libcperciva/util/asprintf.c(20) : warning C4996: 'vsnprintf': This function or variable may be unsafe. Consider using vsnprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
        C:UsersNeverAppDataLocalProgramsCommonMicrosoftVisual C++ for Python9.0VCIncludestdio.h(350) : see declaration of 'vsnprintf'
scrypt-1.2.1/libcperciva/util/asprintf.c(34) : warning C4996: 'vsnprintf': This function or variable may be unsafe. Consider using vsnprintf_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.
        C:UsersNeverAppDataLocalProgramsCommonMicrosoftVisual C++ for Python9.0VCIncludestdio.h(350) : see declaration of 'vsnprintf'
gettimeofday.c
MSVCRT.lib(MSVCR90.dll) : error LNK2005: _vsnprintf already defined in libcrypto_static.lib(cryptlib.obj)
scrypt.obj : warning LNK4197: export 'init_scrypt' specified multiple times; using first specification
   Creating library buildtemp.win-amd64-2.7Releasesrc_scrypt.lib and object buildtemp.win-amd64-2.7Releasesrc_scrypt.exp
libcrypto_static.lib(cryptlib.obj) : error LNK2019: unresolved external symbol __imp___stdio_common_vswprintf referenced in function OPENSSL_showfatal
libcrypto_static.lib(cryptlib.obj) : error LNK2019: unresolved external symbol __imp___stdio_common_vsprintf referenced in function OPENSSL_showfatal
buildlib.win-amd64-2.7_scrypt.pyd : fatal error LNK1120: 2 unresolved externals
error: Setup script exited with error: command 'C:\Users\Never\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\link.exe' failed with exit status 1120

我决定尝试下载win64 openssl v1.1.1.1b, hg clone http://bitbucket.org/mhallin/py-scrypt,editing setup.py看起来像这样:

#!/usr/bin/env python
# -*- coding: utf-8 -*-
from setuptools import setup, Extension
import sys
import platform
import struct
import os
includes = []
libraries = []
library_dirs = []
extra_sources = []
CFLAGS = []

if sys.platform.startswith('linux'):
    define_macros = [('HAVE_CLOCK_GETTIME', '1'),
                     ('HAVE_LIBRT', '1'),
                     ('HAVE_POSIX_MEMALIGN', '1'),
                     ('HAVE_STRUCT_SYSINFO', '1'),
                     ('HAVE_STRUCT_SYSINFO_MEM_UNIT', '1'),
                     ('HAVE_STRUCT_SYSINFO_TOTALRAM', '1'),
                     ('HAVE_SYSINFO', '1'),
                     ('HAVE_SYS_SYSINFO_H', '1'),
                     ('_FILE_OFFSET_BITS', '64')]
    libraries = ['crypto', 'rt']
    includes = ['/usr/local/include', '/usr/include']
    CFLAGS.append('-O2')
elif sys.platform.startswith('win32'):
    define_macros = [('inline', '__inline')]
    extra_sources = ['scrypt-windows-stubs/gettimeofday.c']
    if struct.calcsize('P') == 8:
        library_dirs = ['c:OpenSSL-Win64lib']
        includes = ['c:OpenSSL-Win64include', 'scrypt-windows-stubs/include']
    else:
        library_dirs = ['c:OpenSSL-Win32lib']
        includes = ['c:OpenSSL-Win32include', 'scrypt-windows-stubs/include']
    windows_link_legacy_openssl = os.environ.get(
        "SCRYPT_WINDOWS_LINK_LEGACY_OPENSSL", None
    )
    if  windows_link_legacy_openssl is None:
        libraries = ['libcrypto_static']
    else:
        libraries = ['libeay32']
    libraries += ["advapi32", "gdi32", "user32", "ws2_32"]
elif sys.platform.startswith('darwin') and platform.mac_ver()[0] < '10.6':
    define_macros = [('HAVE_SYSCTL_HW_USERMEM', '1')]
    # disable for travis
    libraries = ['crypto']
elif sys.platform.startswith('darwin'):
    define_macros = [('HAVE_POSIX_MEMALIGN', '1'),
                     ('HAVE_SYSCTL_HW_USERMEM', '1')]
    # disable for travis
    libraries = ['crypto']
else:
    define_macros = [('HAVE_POSIX_MEMALIGN', '1'),
                     ('HAVE_SYSCTL_HW_USERMEM', '1')]
    libraries = ['crypto']
scrypt_module = Extension(
    '_scrypt',
    sources=['src/scrypt.c',
             'scrypt-1.2.1/lib/crypto/crypto_scrypt_smix_sse2.c',
             'scrypt-1.2.1/lib/crypto/crypto_scrypt_smix.c',
             'scrypt-1.2.1/lib/crypto/crypto_scrypt.c',
             'scrypt-1.2.1/lib/scryptenc/scryptenc.c',
             'scrypt-1.2.1/lib/scryptenc/scryptenc_cpuperf.c',
             'scrypt-1.2.1/lib/util/memlimit.c',
             'scrypt-1.2.1/libcperciva/alg/sha256.c',
             'scrypt-1.2.1/libcperciva/crypto/crypto_aes_aesni.c',
             'scrypt-1.2.1/libcperciva/crypto/crypto_aes.c',
             'scrypt-1.2.1/libcperciva/crypto/crypto_aesctr.c',
             'scrypt-1.2.1/libcperciva/crypto/crypto_entropy.c',
             'scrypt-1.2.1/libcperciva/util/entropy.c',
             'scrypt-1.2.1/libcperciva/util/insecure_memzero.c',
             'scrypt-1.2.1/libcperciva/util/warnp.c',
             'scrypt-1.2.1/libcperciva/util/humansize.c',
             'scrypt-1.2.1/libcperciva/util/asprintf.c'] + extra_sources,
    include_dirs=['scrypt-1.2.1',
                  'scrypt-1.2.1/lib',
                  'scrypt-1.2.1/lib/scryptenc',
                  'scrypt-1.2.1/lib/crypto',
                  'scrypt-1.2.1/lib/util',
                  'scrypt-1.2.1/libcperciva/cpusupport',
                  'scrypt-1.2.1/libcperciva/alg',
                  'scrypt-1.2.1/libcperciva/util',
                  'scrypt-1.2.1/libcperciva/crypto'] + includes,
    define_macros=[('HAVE_CONFIG_H', None)] + define_macros,
    extra_compile_args=CFLAGS,
    library_dirs=library_dirs,
    libraries=libraries)
setup(name='scrypt',
      version='0.8.13',
      description='Bindings for the scrypt key derivation function library',
      author='Magnus Hallin',
      author_email='mhallin@gmail.com',
      maintainer="Holger Nahrstaedt",
      maintainer_email="holger@nahrstaedt.de",
      url='http://bitbucket.org/mhallin/py-scrypt',
      packages=['scrypt'],
      ext_modules=[scrypt_module],
      classifiers=['Development Status :: 4 - Beta',
                   'Intended Audience :: Developers',
                   'License :: OSI Approved :: BSD License',
                   'Programming Language :: Python :: 2.7',
                   'Programming Language :: Python :: 3',
                   'Programming Language :: Python :: 3.4',
                   'Programming Language :: Python :: 3.5',
                   'Programming Language :: Python :: 3.6',
                   'Programming Language :: Python :: 3.7',
                   'Topic :: Security :: Cryptography',
                   'Topic :: Software Development :: Libraries'],
      license='2-clause BSD',
      long_description=open('README.rst').read(),
      test_suite='tests.all_tests')

不确定我是否做对了。我有很长时间发布的结果,但是python setup.py build的错误是:

libcrypto_static.lib(cryptlib.obj) : error LNK2019: unresolved external symbol __imp___stdio_common_vswprintf referenced in function OPENSSL_showfatal
libcrypto_static.lib(cryptlib.obj) : error LNK2019: unresolved external symbol __imp___stdio_common_vsprintf referenced in function OPENSSL_showfatal
buildlib.win-amd64-2.7_scrypt.pyd : fatal error LNK1120: 2 unresolved externals
error: command 'C:\Users\Never\AppData\Local\Programs\Common\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\link.exe' failed with exit status 1120

它默认是REEE的另一个错误消息!"仅与Microsoft Visual C 编译器一起使用此标头!"当我"重新安装" diSutiTils.cfg时。这是打击,我已经将所有这些库都安装在大约6年历史的系统上,它炸毁了,我刚刚得到了构建新的零件。我知道它可以安装,我只是不记得我是如何将其删除的。

我建议尝试python -m easy_install scrypt。过去,每当我遇到failed with error code 1的错误时,我都会使用easy_install而不是pip,并且可以很好地工作。

pip install scrypt==0.8.11 :)

上面的.11也会显示出类似的错误。

安装Win64OpenSSL-1_1_1c.msi..

当我为IDA 7

安装键盘时,我已经收到了这样的错误

相关内容

  • 没有找到相关文章

最新更新