是否有一个适用于Alpine的软件包允许我为Python 3安装PyCrypto?
在遇到pip3 install pycrypto
的问题后,我偶然发现了这篇文章,该文章使用how to install numpy in Alpine解释了apk add py-numpy@testing
。也可以使用apk add py-crypto
为Python2.7安装PyCrypto。但是,我似乎无法弄清楚如何为Python3调用pycrypto,即使这个包存在。
作为替代解决方案,我尝试使用apk add gcc
安装C编译器gcc,以便pip3 install pycrypto
中的设置工具可以编译。但是,当我用gcc运行该命令时,它会抛出一个致命的错误:
...
running build_ext
running build_configure
checking for gcc... gcc
checking whether the C compiler works... no
configure: error: in `/tmp/pip-build-2TivSm/pycrypto':
configure: error: C compiler cannot create executables
...
有无法在Alpine中编译Python3模块吗?
这对我有用:
apk add gcc g++ make libffi-dev openssl-dev
然后做你的pip安装。
configure:错误:C编译器无法创建可执行文件
在alpine安装他们的SDK。
对于Alpine中的任何编译内容,请确保您拥有这些包。
alpine-sdk autoconf automake libtool
安装它apk add --no-cache alpine-sdk autoconf automake libtool
PyCrypto似乎有python 3的问题,我有很多努力。如果您使用的是Windows,这个解决方案对我有用:
lib/Crypto/Random/OSRNG/nt.py
并用import winrandom
替换from Crypto.Random.OSRNG import winrandom
。python setup.py build -c msvc python setup.py install python setup.py test
运行以下命令从我的github project(开发分支)获取的说明。