无法安装简单加密

问题描述

我正在尝试安装python“ simple-crypt”软件包。

我得到那些错误

  warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
  building 'Crypto.Hash._MD2' extension
  creating build/temp.linux-x86_64-3.8
  creating build/temp.linux-x86_64-3.8/src
  x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -fwrapv -Wall -fstack-protector-strong -Wformat -Werror=format-security -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python3.8 -c src/MD2.c -o build/temp.linux-x86_64-3.8/src/MD2.o
  src/MD2.c:31:10: Fatal error: Python.h: No such file or directory
   #include "Python.h"
            ^~~~~~~~~~
  compilation terminated.
  error: command 'x86_64-linux-gnu-gcc' Failed with exit status 1

  ----------------------------------------
  Failed building wheel for pycrypto
  Running setup.py clean for pycrypto
Failed to build pycrypto
Installing collected packages: pycrypto,simple-crypt
  Running setup.py install for pycrypto ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools,tokenize;__file__='/tmp/pip-build-p3xxymfk/pycrypto/setup.py';f=getattr(tokenize,'open',open)(__file__);code=f.read().replace('\r\n','\n');f.close();exec(compile(code,__file__,'exec'))" install --record /tmp/pip-o50gn6p7-record/install-record.txt --single-version-externally-managed --compile:
    warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
    building 'Crypto.Hash._MD2' extension
    creating build/temp.linux-x86_64-3.8
    creating build/temp.linux-x86_64-3.8/src
    x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -fwrapv -Wall -fstack-protector-strong -Wformat -Werror=format-security -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -std=c99 -O3 -fomit-frame-pointer -Isrc/ -I/usr/include/python3.8 -c src/MD2.c -o build/temp.linux-x86_64-3.8/src/MD2.o
    src/MD2.c:31:10: Fatal error: Python.h: No such file or directory
     #include "Python.h"
              ^~~~~~~~~~
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' Failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools,'exec'))" install --record /tmp/pip-o50gn6p7-record/install-record.txt --single-version-externally-managed --compile" Failed with error code 1 in /tmp/pip-build-p3xxymfk/pycrypto/

解决方法

我需要一个与我的python版本匹配的python-dev。

我有python 3.8.5,所以: apt-get install python3.8-dev

现在,我可以毫无错误地安装simple-crypt。