, _big_num_ctypes.py. , Visual Studio, crypto.dll. . , _big_num_ctypes.py:
from ctypes.util import find_library
.
.
from .._ffi import LibraryNotFoundError, FFIEngineError
try:
libcrypto_path = find_library(b'crypto' if sys.version_info < (3,) else 'crypto')
if not libcrypto_path:
raise LibraryNotFoundError('The library libcrypto could not be found')
.
.
except (AttributeError):
raise FFIEngineError('Error initializing ctypes')
:
C:\>cd "C:\ProgramData\Anaconda3\Lib\site-packages\asn1crypto\_perf"
C:\ProgramData\Anaconda3\Lib\site-packages\asn1crypto\_perf>python _big_num_ctypes.py
Traceback :
Traceback (most recent call last):
File "_big_num_ctypes.py", line 27, in <module>
from .._ffi import LibraryNotFoundError, FFIEngineError
ValueError: attempted relative import beyond top-level package
, .ffi :
from asn1crypto._ffi import LibraryNotFoundError, FFIEngineError
libcrypto:
asn1crypto._ffi.LibraryNotFoundError: The library libcrypto could not be found
, dll crypto C:\Windows\System32 / SYSWOW64 ( 64-)
libcrypto_path = find_library(b'crypto' if sys.version_info < (3,) else 'crypto')
find_library - . , docs. - , None.
>>> from ctypes.util import find_library
>>> print(find_library("c"))
None
crypto.dll, . , . :
>>> find_library('crypto')
'C:\\windows\\system32\\crypto.dll'
python _big_num_ctypes.py Traceback:
Traceback (most recent call last):
File "_big_num_ctypes.py", line 37, in <module>
libcrypto = CDLL(libcrypto_path)
File "C:\ProgramData\Anaconda3\lib\ctypes\__init__.py", line 348, in __init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 193] %1 is not a valid Win32 application
, 32- DLL 64- Python , , . , 32- Python 3.6 py -3.6-32 _big_num_ctypes.py. , .
, Crypto 32- ? answer .
, Pycryptodome Crypto, Crypto. , , , MS Visual Studio 2015 (Community Edition) C/++ . , ++ MS Visual Studio .
, crypto.dll Pycryptodome, , . OpenSSL Twilio. , MS Visual Studio , .
unittest, :
.
----------------------------------------------------------------------
Ran 1 test in 0.771s
OK