1

安装“pip3 install pycrypto”时出现此错误:

   creating build/lib.linux-armv7l-3.6/Crypto/Protocol
    copying lib/Crypto/Protocol/AllOrNothing.py -> build/lib.linux-armv7l-3.6/Crypto/Protocol
    copying lib/Crypto/Protocol/Chaffing.py -> build/lib.linux-armv7l-3.6/Crypto/Protocol
    copying lib/Crypto/Protocol/KDF.py -> build/lib.linux-armv7l-3.6/Crypto/Protocol
    copying lib/Crypto/Protocol/__init__.py -> build/lib.linux-armv7l-3.6/Crypto/Protocol
    creating build/lib.linux-armv7l-3.6/Crypto/PublicKey
    copying lib/Crypto/PublicKey/_slowmath.py -> build/lib.linux-armv7l-3.6/Crypto/PublicKey
    copying lib/Crypto/PublicKey/pubkey.py -> build/lib.linux-armv7l-3.6/Crypto/PublicKey
    copying lib/Crypto/PublicKey/RSA.py -> build/lib.linux-armv7l-3.6/Crypto/PublicKey
    copying lib/Crypto/PublicKey/DSA.py -> build/lib.linux-armv7l-3.6/Crypto/PublicKey
    copying lib/Crypto/PublicKey/_DSA.py -> build/lib.linux-armv7l-3.6/Crypto/PublicKey
    copying lib/Crypto/PublicKey/ElGamal.py -> build/lib.linux-armv7l-3.6/Crypto/PublicKey
    copying lib/Crypto/PublicKey/_RSA.py -> build/lib.linux-armv7l-3.6/Crypto/PublicKey
    copying lib/Crypto/PublicKey/__init__.py -> build/lib.linux-armv7l-3.6/Crypto/PublicKey
    creating build/lib.linux-armv7l-3.6/Crypto/Signature
    copying lib/Crypto/Signature/PKCS1_PSS.py -> build/lib.linux-armv7l-3.6/Crypto/Signature
    copying lib/Crypto/Signature/PKCS1_v1_5.py -> build/lib.linux-armv7l-3.6/Crypto/Signature
    copying lib/Crypto/Signature/__init__.py -> build/lib.linux-armv7l-3.6/Crypto/Signature
    warning: PCTBuildPy: byte-compiling is disabled, skipping.

    running build_ext
    running build_configure
    checking for gcc... gcc
    checking whether the C compiler works... yes
    checking for C compiler default output file name... a.out
    checking for suffix of executables...
    checking whether we are cross compiling... configure: error: in `/tmp/pip-build-71pdfh2i/pycrypto':
    configure: error: cannot run C compiled programs.
    If you meant to cross compile, use `--host'.
    See `config.log' for more details
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-71pdfh2i/pycrypto/setup.py", line 456, in <module>
        core.setup(**kw)
      File "/core.py", line 148, in setup
      File "/dist.py", line 955, in run_commands
      File "/dist.py", line 974, in run_command
      File "/opt/lib/python3.6/site-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/install.py", line 545, in run
      File "/cmd.py", line 313, in run_command
      File "/dist.py", line 974, in run_command
      File "/build.py", line 135, in run
      File "/cmd.py", line 313, in run_command
      File "/dist.py", line 974, in run_command
      File "/tmp/pip-build-71pdfh2i/pycrypto/setup.py", line 251, in run
        self.run_command(cmd_name)
      File "/cmd.py", line 313, in run_command
      File "/dist.py", line 974, in run_command
      File "/tmp/pip-build-71pdfh2i/pycrypto/setup.py", line 278, in run
        raise RuntimeError("autoconf error")
    RuntimeError: autoconf error

    ----------------------------------------
Command "/opt/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-71pdfh2i/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-cbi74gir-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-71pdfh2i/pycrypto/

我的坐骑:

root@router2:~# mount
/dev/root on / type squashfs (ro,relatime)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
ramfs on /tmp type ramfs (rw,relatime)
none on /dev type tmpfs (rw,relatime,size=512K)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
devpts on /proc/bus/usb type usbfs (rw,relatime)
/dev/sda1 on /opt type ext4 (rw,relatime,data=ordered)
/dev/sda1 on /tmp/mnt/sda1 type ext4 (rw,relatime,data=ordered)

当使用 TMPDIR=/opt/tmp pip3 install pycrypto 我也有问题(谷歌显示 TMPDIR 必须在没有“noexec”的情况下安装):

    creating build/lib.linux-armv7l-3.6/Crypto/PublicKey
    copying lib/Crypto/PublicKey/pubkey.py -> build/lib.linux-armv7l-3.6/Crypto/PublicKey
    copying lib/Crypto/PublicKey/_RSA.py -> build/lib.linux-armv7l-3.6/Crypto/PublicKey
    copying lib/Crypto/PublicKey/_DSA.py -> build/lib.linux-armv7l-3.6/Crypto/PublicKey
    copying lib/Crypto/PublicKey/_slowmath.py -> build/lib.linux-armv7l-3.6/Crypto/PublicKey
    copying lib/Crypto/PublicKey/RSA.py -> build/lib.linux-armv7l-3.6/Crypto/PublicKey
    copying lib/Crypto/PublicKey/DSA.py -> build/lib.linux-armv7l-3.6/Crypto/PublicKey
    copying lib/Crypto/PublicKey/__init__.py -> build/lib.linux-armv7l-3.6/Crypto/PublicKey
    copying lib/Crypto/PublicKey/ElGamal.py -> build/lib.linux-armv7l-3.6/Crypto/PublicKey
    creating build/lib.linux-armv7l-3.6/Crypto/Signature
    copying lib/Crypto/Signature/PKCS1_v1_5.py -> build/lib.linux-armv7l-3.6/Crypto/Signature
    copying lib/Crypto/Signature/PKCS1_PSS.py -> build/lib.linux-armv7l-3.6/Crypto/Signature
    copying lib/Crypto/Signature/__init__.py -> build/lib.linux-armv7l-3.6/Crypto/Signature
    warning: PCTBuildPy: byte-compiling is disabled, skipping.

    running build_ext
    running build_configure
    checking for gcc... gcc
    checking whether the C compiler works... yes
    checking for C compiler default output file name... a.out
    checking for suffix of executables...
    checking whether we are cross compiling... configure: error: in `/opt/tmp/pip-build-ve5o0p9a/pycrypto':
    configure: error: cannot run C compiled programs.
    If you meant to cross compile, use `--host'.
    See `config.log' for more details
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/opt/tmp/pip-build-ve5o0p9a/pycrypto/setup.py", line 456, in <module>
        core.setup(**kw)
      File "/core.py", line 148, in setup
      File "/dist.py", line 955, in run_commands
      File "/dist.py", line 974, in run_command
      File "/opt/lib/python3.6/site-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/install.py", line 545, in run
      File "/cmd.py", line 313, in run_command
      File "/dist.py", line 974, in run_command
      File "/build.py", line 135, in run
      File "/cmd.py", line 313, in run_command
      File "/dist.py", line 974, in run_command
      File "/opt/tmp/pip-build-ve5o0p9a/pycrypto/setup.py", line 251, in run
        self.run_command(cmd_name)
      File "/cmd.py", line 313, in run_command
      File "/dist.py", line 974, in run_command
      File "/opt/tmp/pip-build-ve5o0p9a/pycrypto/setup.py", line 278, in run
        raise RuntimeError("autoconf error")
    RuntimeError: autoconf error

    ----------------------------------------
Command "/opt/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/opt/tmp/pip-build-ve5o0p9a/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 /opt/tmp/pip-xa11ohvn-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /opt/tmp/pip-build-ve5o0p9a/pycrypto/

安装了 gcc、autoconf、automake、python3-dev、python3-pip、python-crypto、python-cryptography。

opkg install gcc, autoconf automake python3-dev, python3-pip, python-crypto, python-cryptography

我试过 set HOME=/opt/tmp and TMPDIR=/opt/tmp or HOME=/opt/tmp TMPDIR=/opt/tmp pip3 install pycrypto 但问题和上面一样。

我阅读了https://github.com/Entware-ng/Entware-ng/wiki/Self-installation-of-python-modules并遵循它但没有成功。

pycrypto 是hass的要求xiaomi 组件 请注意,这是针对 python 3 而不是 python 2。

Platform:
Buffalo WZR-1750DHP
Firmware: DD-WRT v3.0-r33006 std (08/03/17)

请告知如何解决此问题。

谢谢!

4

0 回答 0