PyCrypto for Alpine3 in Alpine?

问题描述 投票:9回答:3

是否有一个适用于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模块吗?

python python-3.x pycrypto alpine
3个回答
14
投票

这对我有用:

apk add gcc g++ make libffi-dev openssl-dev

然后做你的pip安装。


0
投票

configure:错误:C编译器无法创建可执行文件

在alpine安装他们的SDK。

对于Alpine中的任何编译内容,请确保您拥有这些包。

alpine-sdk autoconf automake libtool

安装它apk add --no-cache alpine-sdk autoconf automake libtool


-3
投票

PyCrypto似乎有python 3的问题,我有很多努力。如果您使用的是Windows,这个解决方案对我有用:

  • 使用Visual C ++安装Visual Studio 2015(VS版本2015仅适用于使用python 3.5+。如果您使用的是3.4,我认为正确的版本是VS2010。对于早期版本,我不确定选择哪个版本,但您可以在互联网上查找有关该信息的信息)
  • 下载pycrypto source。目前稳定版本是pycrypto-2.6.1。使用这个,而不是下面的实验版本。
  • 提取存档
  • 编辑文件lib/Crypto/Random/OSRNG/nt.py并用import winrandom替换from Crypto.Random.OSRNG import winrandom
  • 从cmd python setup.py build -c msvc python setup.py install python setup.py test运行以下命令
  • 如果测试会给你带来一些错误,那么无论如何你都可以侥幸逃脱。

从我的github project(开发分支)获取的说明。

© www.soinside.com 2019 - 2024. All rights reserved.