当前位置: 首页 > 工具软件 > Charm-crypto > 使用案例 >

charm-crypto库安装

狄安歌
2023-12-01

charm-crypto库安装

安装过程中踩了很多坑,总结一下

Linux 安装

参考博客

charm安装:https://blog.csdn.net/qq_34823530/article/details/96605662

python3.7安装:https://cloud.tencent.com/developer/article/1570488

ubuntu下yum安装:https://blog.csdn.net/zhangwen_x/article/details/100580477(yum安装报错的情况下,更新数据源到清华源不起作用,更新到阿里云就解决了)

安装python37的报错处理:https://blog.csdn.net/u014775723/article/details/85224447?spm=1001.2101.3001.6650.4&utm_medium=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-4-85224447-blog-121011929.pc_relevant_antiscanv2&depth_1-utm_source=distribute.pc_relevant.none-task-blog-2%7Edefault%7ECTRLIST%7ERate-4-85224447-blog-121011929.pc_relevant_antiscanv2&utm_relevant_index=5

安装过程

0 安装yum

sudo apt-get update
sudo apt-get upgrade
apt-get install yum

如果直接用这个命令没用,那就挺费劲了,如下

(我遇到的问题是 找不到包的位置Unable to locate package)

有效的方法是添加数据源,一开始添加了清华源还是不行,后来添加了阿里源,就ok了,就可以再用上面的命令安装成功了

cd /etc/apt/
sudo cp /etc/apt/sources.list   /etc/apt/sources.list.backup
sudo gedit sources.list    #当使用gedit不行,就用的nano

添加如下内容:

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security multiverse
# 应该是下面的阿里云源起作用了
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

添加完一定要记得update和upgrade

1 修改python版本

为了使得库能够正常运行,将python版本设置为3.7。如果已经是3.7可以忽略这一步

cd /usr/local/ 
mkdir Python37     //创建一个文件夹用于存放下载的python3压缩包 
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz   //linux下载python3.7.0指令
tar -zxvf Python-3.7.0.tgz
mkdir /usr/local/Python/py3_project
cd Python-3.7.0
./configure --prefix=/usr/local/python3   //配置
make && make install   //编译并且安装

最后两步可能会报错(如下),主要是因为缺少依赖

There are no enabled repos.
 Run "yum repolist all" to see the repos you have.
 To enable Red Hat Subscription Management repositories:
     subscription-manager repos --enable <repo>
 To enable custom repositories:
     yum-config-manager --enable <repo>

此时使用"yum repolist all"命令的返回值为0

安装依赖包,亲测使用aptitude命令安装最靠谱

sudo apt-get install aptitude

# sudo aptitude pachagename
sudo aptitude dist-upgrade
sudo aptitude install build-essential python-dev python-setuptools python-pip python-smbus
sudo aptitude install build-essential libncursesw5-dev libgdbm-dev libc6-dev
sudo aptitude install zlib1g-dev libsqlite3-dev tk-dev
sudo aptitude install libssl-dev openssl
sudo aptitude install libffi-dev
yum -y install openssl-devel

# 到py37的文件夹下
./configure --prefix=/usr/local/python3   //配置
make && make install   //编译并且安装

建立软连接

ln -s /usr/local/python3/bin/python3.7 /usr/bin/python3 
ln -s /usr/local/python3/bin/pip3.7 /usr/bin/pip3

2 准备文件

先用第一个链接里面给到的云盘下载文件

链接:https://pan.baidu.com/s/14FLFP7jMWdZ337DcrGf_lQ
提取码:zhhl

3 执行安装

必须安装依赖库:GMP,PBC,OPENSSL

sudo apt-get install m4
sudo apt-get install flex
sudo apt-get install bison

安装gmp,pbc,openssl库(下载上面的云盘的包)或者在下面的网站上下载

​ Pyparsing http://pyparsing.wikispaces.com/ 这个装python的时候就装了
​ GMP 5.x http://gmplib.org/
​ PBC (latest) http://crypto.stanford.edu/pbc/news.html
​ OPENSSL http://www.openssl.org/

把每个安装包解压,然后./configure make make install 三步走

注意:
OpenSSL是 ./config make make install

最后用同样的方式解压,并安装charm-crypto

./configure.sh  
make && make install

Windows 安装

(待更新……)

 类似资料: