1. 程式人生 > 其它 >Windows 上安裝charm-crypto

Windows 上安裝charm-crypto

技術標籤:庫的安裝

下載連結:https://download.csdn.net/download/weixin_49722641/14933823
包含需要的所有檔案
一、預製包裝
1.為Windows x64安裝Python 3.5
2.下載charm-crypto-win-x64.7z
解壓縮charm-crypto-win-x64.7z 並轉到charm-crypto資料夾
將所有.dll檔案複製到C:\Windows\System32。

**檔案在我的資源裡**

3.easy_install 的安裝https://pypi.python.org/pypi/ez_setup下載 ez_setup.py 到桌面後,按住鍵盤的 shift 鍵,右擊滑鼠,選中“在此處開啟命令視窗”,進入 DOS 介面,輸入命令:python ez_setup.py

4.cmd下執行以下命令以安裝適用於64位Python的Charm-crypto:

easy_install Charm_Crypto-0.43-py3.5-win-amd64.egg

二、使用Mingw64和Python64位手動安裝

1.安裝MSYS2 MSYS2_64_installer

**檔案在我的資源裡**

2.開啟MSYS2 Shell(C:\ msys64 \ msys2.exe)更新軟體包(從MSYS2 shell):

pacman -Sy pacman
pacman -Syu
pacman -Su

3.安裝Mingw64工具鏈(從MSYS2 shell):

pacman -
S mingw-w64-x86_64-gcc pacman -S make

4.安裝charm-crypto依賴關係(從MSYS2 shell):

開啟 MSYS2 Shell(C:\ msys64 \ msys2.exe)
安裝野牛 pacman -S bison
安裝 openssl-dev pacman -S openssl-devel
安裝 gmp-dev pacman -S gmp-devel

5.構建 PBC庫(charm-crypto依賴項)下載PBC檔案

**檔案在我的資源裡**

6.開啟Mingw64 shell(C:\ msys64 \ mingw64.exe)
轉到PBC目錄下 建立PBC:三句分開

 ./configure --prefix=/mingw64 --disable-static --enable-shared
 make
 make install

7.將mingw64 / bin(C:\ msys64 \ mingw64 \ bin)新增到PATH
8.從gendef下載並提取gendef.exe,將gendef.exe 複製到 mingw64 / bin(C:\ msys64 \ mingw64 / bin)

**檔案在我的資源裡**

9.將python35.dll 複製到python路徑的libs資料夾:
10.Mingw64 shell中,修補libpython35.a

cd C:\Python\Python35\libs
rename python35.lib old_python35.lib
gendef python35.dll
dlltool --dllname python35.dll --def python35.def --output-lib libpython35.a

11.修補pyconfig.h:
開啟C:\ Python \ Python35 \ include \ pyconfig.h
在該檔案中搜索text #ifdef _WIN64,並剪下以下三行,搜尋文字#ifdef _MSC_VER。貼上到#ifdef _MSC_VER上方。

#ifdef _WIN64
#define MS_WIN64
#endif

12.開啟C: \ Python \ Python35 \ Lib \ distutils \ cygwinccompiler.py
註釋掉所有行get_msvcr()。可加pass。

13.轉到解壓縮的charm-crypto資料夾,在以下檔案的頂部新增:
#include <stdint.h>

Charm-Crypto-0.43\charm\core\math\integer\integermodule.h
Charm-Crypto-0.43\charm\core\math\elliptic_curve\ecmodule.h
Charm-Crypto-0.43\charm\core\math\pairing\pairingmodule.h
開啟Mingw64 shell(C:\ msys64 \ mingw64.exe)

14.Mingw64 shell中,構建charm-crypto(指定python35.exe的路徑) 轉到\Charm-Crypto-0.43目錄下

 ./configure.sh --prefix=/mingw64 --python=/Python/Python35/python.exe 
 make
 make install