注意这个 Crypto 库一般情况在导入的时候都会出错,有几种情况,我介绍一下我遇到的,就是我之前安装了 pycrypto 这个库,但是这个库最新的一版是 2014 年,已经不兼容了,当我尝试 uninstall 它时,报错 ERROR: Cannot uninstall 'pycrypto'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall. 这时候,我们必须全局搜索 pycrypto,并手动删除那个文件夹 然后在cmd 下安装 pip install pycryptodome --user
if m%2==0: returnFalse for i in range(k): a = random.randint(2,m-2) g = gmpy2.gcd(a,m) if g==1: r = gmpy2.powmod(a,m-1,m) if r ==1: continue else: returnFalse else: returnFalse returnTrue