1

$pip install web3在 python_virtual_env 中使用,但出现以下错误。

Defaulting to user installation because normal site-packages is not writeable
    Collecting web3
      Using cached web3-5.7.0-py3-none-any.whl (460 kB)
    Collecting hexbytes<1.0.0,>=0.1.0
      Using cached hexbytes-0.2.0-py3-none-any.whl (5.3 kB)
    Collecting jsonschema<4.0.0,>=3.0.0
      Using cached jsonschema-3.2.0-py2.py3-none-any.whl (56 kB)
    Collecting typing-extensions<4,>=3.7.4.1; python_version < "3.8"
      Using cached typing_extensions-3.7.4.2-py3-none-any.whl (22 kB)
    Collecting protobuf<4,>=3.10.0
      Using cached protobuf-3.11.3-cp36-cp36m-manylinux1_x86_64.whl (1.3 MB)
    Requirement already satisfied: websockets<9.0.0,>=8.1.0 in /home/ajay/.local/lib/python3.6/site-packages (from web3) (8.1)
    Collecting ipfshttpclient<1,>=0.4.12
      Using cached ipfshttpclient-0.4.12-py2.py3-none-any.whl (157 kB)
    Requirement already satisfied: requests<3.0.0,>=2.16.0 in /usr/lib/python3/dist-packages (from web3) (2.18.4)
    Collecting eth-abi<3.0.0,>=2.0.0b6
      Using cached eth_abi-2.1.1-py3-none-any.whl (27 kB)
    Requirement already satisfied: eth-hash[pycryptodome]<1.0.0,>=0.2.0 in /home/ajay/.local/lib/python3.6/site-packages (from web3) (0.2.0)
    Collecting lru-dict<2.0.0,>=1.1.6
      Using cached lru-dict-1.1.6.tar.gz (9.4 kB)
    Collecting eth-account<0.5.0,>=0.4.0
      Using cached eth_account-0.4.0-py3-none-any.whl (26 kB)
    Requirement already satisfied: eth-typing<3.0.0,>=2.0.0 in /home/ajay/.local/lib/python3.6/site-packages (from web3) (2.2.1)
    Collecting eth-utils<2.0.0,>=1.8.4
      Using cached eth_utils-1.8.4-py3-none-any.whl (23 kB)
    Collecting attrs>=17.4.0
      Using cached attrs-19.3.0-py2.py3-none-any.whl (39 kB)
    Collecting importlib-metadata; python_version < "3.8"
      Using cached importlib_metadata-1.6.0-py2.py3-none-any.whl (30 kB)
    Requirement already satisfied: setuptools in /home/ajay/.local/lib/python3.6/site-packages (from jsonschema<4.0.0,>=3.0.0->web3) (46.1.3)
    Requirement already satisfied: six>=1.11.0 in /usr/lib/python3/dist-packages (from jsonschema<4.0.0,>=3.0.0->web3) (1.11.0)
    Processing /home/ajay/.cache/pip/wheels/d1/8a/1c/32ab9017418a2c64e4fbaf503c08648bed2f8eb311b869a464/pyrsistent-0.16.0-cp36-cp36m-linux_x86_64.whl
    Collecting multiaddr>=0.0.7
      Using cached multiaddr-0.0.9-py2.py3-none-any.whl (16 kB)
    Processing /home/ajay/.cache/pip/wheels/43/95/c9/c9f7a3f9dc34ebd851739148bd5b42ab35618ea0808388647c/parsimonious-0.8.1-py3-none-any.whl
    Requirement already satisfied: pycryptodome<4,>=3.6.6; extra == "pycryptodome" in /home/ajay/.local/lib/python3.6/site-packages (from eth-hash[pycryptodome]<1.0.0,>=0.2.0->web3) (3.9.7)
    Collecting eth-rlp<1,>=0.1.2
      Using cached eth_rlp-0.1.2-py3-none-any.whl (6.5 kB)
    Collecting rlp<2,>=1.0.0
      Using cached rlp-1.2.0-py2.py3-none-any.whl (19 kB)
    Collecting attrdict<3,>=2.0.0
      Using cached attrdict-2.0.1-py2.py3-none-any.whl (9.9 kB)
    Collecting eth-keys<0.3.0,>=0.2.1
      Using cached eth_keys-0.2.4-py3-none-any.whl (24 kB)
    Collecting eth-keyfile<0.6.0,>=0.5.0
      Using cached eth_keyfile-0.5.1-py3-none-any.whl (8.3 kB)
    Collecting cytoolz<1.0.0,>=0.10.1; implementation_name == "cpython"
      Using cached cytoolz-0.10.1.tar.gz (475 kB)
    Collecting zipp>=0.5
      Using cached zipp-3.1.0-py3-none-any.whl (4.9 kB)
    Processing /home/ajay/.cache/pip/wheels/35/f3/7e/e67e5ecf7e79b875e840bee3258c29ade8bffd56542d9c9c39/varint-1.0.2-py3-none-any.whl
    Collecting base58
      Using cached base58-2.0.0-py3-none-any.whl (6.0 kB)
    Collecting netaddr
      Using cached netaddr-0.7.19-py2.py3-none-any.whl (1.6 MB)
    Requirement already satisfied: toolz>=0.8.0 in /home/ajay/.local/lib/python3.6/site-packages (from cytoolz<1.0.0,>=0.10.1; implementation_name == "cpython"->eth-utils<2.0.0,>=1.8.4->web3) (0.10.0)
    Building wheels for collected packages: lru-dict, cytoolz
      Building wheel for lru-dict (setup.py) ... error
      ERROR: Command errored out with exit status 1:
       command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-j__tim18/lru-dict/setup.py'"'"'; __file__='"'"'/tmp/pip-install-j__tim18/lru-dict/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-023_93_d
           cwd: /tmp/pip-install-j__tim18/lru-dict/
      Complete output (12 lines):
      running bdist_wheel
      running build
      running build_ext
      building 'lru' extension
      creating build
      creating build/temp.linux-x86_64-3.6
      x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.6m -c lru.c -o build/temp.linux-x86_64-3.6/lru.o
      lru.c:1: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
      ----------------------------------------
      ERROR: Failed building wheel for lru-dict
      Running setup.py clean for lru-dict
      Building wheel for cytoolz (setup.py) ... error
      ERROR: Command errored out with exit status 1:
       command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-j__tim18/cytoolz/setup.py'"'"'; __file__='"'"'/tmp/pip-install-j__tim18/cytoolz/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-o4caiffl
           cwd: /tmp/pip-install-j__tim18/cytoolz/
      Complete output (57 lines):
      ALERT: Cython not installed.  Building without Cython.
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-3.6
      creating build/lib.linux-x86_64-3.6/cytoolz
      copying cytoolz/compatibility.py -> build/lib.linux-x86_64-3.6/cytoolz
      copying cytoolz/_signatures.py -> build/lib.linux-x86_64-3.6/cytoolz
      copying cytoolz/_version.py -> build/lib.linux-x86_64-3.6/cytoolz
      copying cytoolz/__init__.py -> build/lib.linux-x86_64-3.6/cytoolz
      copying cytoolz/utils_test.py -> build/lib.linux-x86_64-3.6/cytoolz
      creating build/lib.linux-x86_64-3.6/cytoolz/curried
      copying cytoolz/curried/operator.py -> build/lib.linux-x86_64-3.6/cytoolz/curried
      copying cytoolz/curried/exceptions.py -> build/lib.linux-x86_64-3.6/cytoolz/curried
      copying cytoolz/curried/__init__.py -> build/lib.linux-x86_64-3.6/cytoolz/curried
      copying cytoolz/recipes.pyx -> build/lib.linux-x86_64-3.6/cytoolz
      copying cytoolz/utils.pyx -> build/lib.linux-x86_64-3.6/cytoolz
      copying cytoolz/itertoolz.pyx -> build/lib.linux-x86_64-3.6/cytoolz
      copying cytoolz/dicttoolz.pyx -> build/lib.linux-x86_64-3.6/cytoolz
      copying cytoolz/functoolz.pyx -> build/lib.linux-x86_64-3.6/cytoolz
      copying cytoolz/__init__.pxd -> build/lib.linux-x86_64-3.6/cytoolz
      copying cytoolz/dicttoolz.pxd -> build/lib.linux-x86_64-3.6/cytoolz
      copying cytoolz/itertoolz.pxd -> build/lib.linux-x86_64-3.6/cytoolz
      copying cytoolz/recipes.pxd -> build/lib.linux-x86_64-3.6/cytoolz
      copying cytoolz/utils.pxd -> build/lib.linux-x86_64-3.6/cytoolz
      copying cytoolz/cpython.pxd -> build/lib.linux-x86_64-3.6/cytoolz
      copying cytoolz/functoolz.pxd -> build/lib.linux-x86_64-3.6/cytoolz
      creating build/lib.linux-x86_64-3.6/cytoolz/tests
      copying cytoolz/tests/test_tlz.py -> build/lib.linux-x86_64-3.6/cytoolz/tests
      copying cytoolz/tests/test_doctests.py -> build/lib.linux-x86_64-3.6/cytoolz/tests
      copying cytoolz/tests/test_curried.py -> build/lib.linux-x86_64-3.6/cytoolz/tests
      copying cytoolz/tests/test_signatures.py -> build/lib.linux-x86_64-3.6/cytoolz/tests
      copying cytoolz/tests/dev_skip_test.py -> build/lib.linux-x86_64-3.6/cytoolz/tests
      copying cytoolz/tests/test_curried_toolzlike.py -> build/lib.linux-x86_64-3.6/cytoolz/tests
      copying cytoolz/tests/test_functoolz.py -> build/lib.linux-x86_64-3.6/cytoolz/tests
      copying cytoolz/tests/test_recipes.py -> build/lib.linux-x86_64-3.6/cytoolz/tests
      copying cytoolz/tests/test_inspect_args.py -> build/lib.linux-x86_64-3.6/cytoolz/tests
      copying cytoolz/tests/test_dicttoolz.py -> build/lib.linux-x86_64-3.6/cytoolz/tests
      copying cytoolz/tests/test_dev_skip_test.py -> build/lib.linux-x86_64-3.6/cytoolz/tests
      copying cytoolz/tests/test_embedded_sigs.py -> build/lib.linux-x86_64-3.6/cytoolz/tests
      copying cytoolz/tests/test_compatibility.py -> build/lib.linux-x86_64-3.6/cytoolz/tests
      copying cytoolz/tests/test_utils.py -> build/lib.linux-x86_64-3.6/cytoolz/tests
      copying cytoolz/tests/test_none_safe.py -> build/lib.linux-x86_64-3.6/cytoolz/tests
      copying cytoolz/tests/test_serialization.py -> build/lib.linux-x86_64-3.6/cytoolz/tests
      copying cytoolz/tests/test_itertoolz.py -> build/lib.linux-x86_64-3.6/cytoolz/tests
      copying cytoolz/tests/test_docstrings.py -> build/lib.linux-x86_64-3.6/cytoolz/tests
      running build_ext
      building 'cytoolz.dicttoolz' extension
      creating build/temp.linux-x86_64-3.6
      creating build/temp.linux-x86_64-3.6/cytoolz
      x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.6m -c cytoolz/dicttoolz.c -o build/temp.linux-x86_64-3.6/cytoolz/dicttoolz.o
      cytoolz/dicttoolz.c:17: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
      ----------------------------------------
      ERROR: Failed building wheel for cytoolz
      Running setup.py clean for cytoolz
    Failed to build lru-dict cytoolz
    Installing collected packages: cytoolz, eth-utils, hexbytes, attrs, zipp, importlib-metadata, pyrsistent, jsonschema, typing-extensions, protobuf, varint, base58, netaddr, multiaddr, ipfshttpclient, parsimonious, eth-abi, lru-dict, rlp, eth-rlp, attrdict, eth-keys, eth-keyfile, eth-account, web3
        Running setup.py install for cytoolz ... error
        ERROR: Command errored out with exit status 1:
         command: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-j__tim18/cytoolz/setup.py'"'"'; __file__='"'"'/tmp/pip-install-j__tim18/cytoolz/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-record-1xzorhvi/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/ajay/.local/include/python3.6m/cytoolz
             cwd: /tmp/pip-install-j__tim18/cytoolz/
        Complete output (57 lines):
        ALERT: Cython not installed.  Building without Cython.
        running install
        running build
        running build_py
        creating build
        creating build/lib.linux-x86_64-3.6
        creating build/lib.linux-x86_64-3.6/cytoolz
        copying cytoolz/compatibility.py -> build/lib.linux-x86_64-3.6/cytoolz
        copying cytoolz/_signatures.py -> build/lib.linux-x86_64-3.6/cytoolz
        copying cytoolz/_version.py -> build/lib.linux-x86_64-3.6/cytoolz
        copying cytoolz/__init__.py -> build/lib.linux-x86_64-3.6/cytoolz
        copying cytoolz/utils_test.py -> build/lib.linux-x86_64-3.6/cytoolz
        creating build/lib.linux-x86_64-3.6/cytoolz/curried
        copying cytoolz/curried/operator.py -> build/lib.linux-x86_64-3.6/cytoolz/curried
        copying cytoolz/curried/exceptions.py -> build/lib.linux-x86_64-3.6/cytoolz/curried
        copying cytoolz/curried/__init__.py -> build/lib.linux-x86_64-3.6/cytoolz/curried
        copying cytoolz/recipes.pyx -> build/lib.linux-x86_64-3.6/cytoolz
        copying cytoolz/utils.pyx -> build/lib.linux-x86_64-3.6/cytoolz
        copying cytoolz/itertoolz.pyx -> build/lib.linux-x86_64-3.6/cytoolz
        copying cytoolz/dicttoolz.pyx -> build/lib.linux-x86_64-3.6/cytoolz
        copying cytoolz/functoolz.pyx -> build/lib.linux-x86_64-3.6/cytoolz
        copying cytoolz/__init__.pxd -> build/lib.linux-x86_64-3.6/cytoolz
        copying cytoolz/dicttoolz.pxd -> build/lib.linux-x86_64-3.6/cytoolz
        copying cytoolz/itertoolz.pxd -> build/lib.linux-x86_64-3.6/cytoolz
        copying cytoolz/recipes.pxd -> build/lib.linux-x86_64-3.6/cytoolz
        copying cytoolz/utils.pxd -> build/lib.linux-x86_64-3.6/cytoolz
        copying cytoolz/cpython.pxd -> build/lib.linux-x86_64-3.6/cytoolz
        copying cytoolz/functoolz.pxd -> build/lib.linux-x86_64-3.6/cytoolz
        creating build/lib.linux-x86_64-3.6/cytoolz/tests
        copying cytoolz/tests/test_tlz.py -> build/lib.linux-x86_64-3.6/cytoolz/tests
        copying cytoolz/tests/test_doctests.py -> build/lib.linux-x86_64-3.6/cytoolz/tests
        copying cytoolz/tests/test_curried.py -> build/lib.linux-x86_64-3.6/cytoolz/tests
        copying cytoolz/tests/test_signatures.py -> build/lib.linux-x86_64-3.6/cytoolz/tests
        copying cytoolz/tests/dev_skip_test.py -> build/lib.linux-x86_64-3.6/cytoolz/tests
        copying cytoolz/tests/test_curried_toolzlike.py -> build/lib.linux-x86_64-3.6/cytoolz/tests
        copying cytoolz/tests/test_functoolz.py -> build/lib.linux-x86_64-3.6/cytoolz/tests
        copying cytoolz/tests/test_recipes.py -> build/lib.linux-x86_64-3.6/cytoolz/tests
        copying cytoolz/tests/test_inspect_args.py -> build/lib.linux-x86_64-3.6/cytoolz/tests
        copying cytoolz/tests/test_dicttoolz.py -> build/lib.linux-x86_64-3.6/cytoolz/tests
        copying cytoolz/tests/test_dev_skip_test.py -> build/lib.linux-x86_64-3.6/cytoolz/tests
        copying cytoolz/tests/test_embedded_sigs.py -> build/lib.linux-x86_64-3.6/cytoolz/tests
        copying cytoolz/tests/test_compatibility.py -> build/lib.linux-x86_64-3.6/cytoolz/tests
        copying cytoolz/tests/test_utils.py -> build/lib.linux-x86_64-3.6/cytoolz/tests
        copying cytoolz/tests/test_none_safe.py -> build/lib.linux-x86_64-3.6/cytoolz/tests
        copying cytoolz/tests/test_serialization.py -> build/lib.linux-x86_64-3.6/cytoolz/tests
        copying cytoolz/tests/test_itertoolz.py -> build/lib.linux-x86_64-3.6/cytoolz/tests
        copying cytoolz/tests/test_docstrings.py -> build/lib.linux-x86_64-3.6/cytoolz/tests
        running build_ext
        building 'cytoolz.dicttoolz' extension
        creating build/temp.linux-x86_64-3.6
        creating build/temp.linux-x86_64-3.6/cytoolz
        x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.6m -c cytoolz/dicttoolz.c -o build/temp.linux-x86_64-3.6/cytoolz/dicttoolz.o
        cytoolz/dicttoolz.c:17: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
        ----------------------------------------
    ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-j__tim18/cytoolz/setup.py'"'"'; __file__='"'"'/tmp/pip-install-j__tim18/cytoolz/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-record-1xzorhvi/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/ajay/.local/include/python3.6m/cytoolz Check the logs for full command output.

为什么会这样,我该如何解决?

4

1 回答 1

0

只需重新运行:

sudo apt-get install python3-dev

致命错误:Python.h:没有这样的文件或目录

于 2020-11-17T21:24:33.467 回答