Python pip安装web3@ubuntu

Python pip安装web3@ubuntu,python,pip,web3,Python,Pip,Web3,尝试从pip安装web3时出现以下问题: $ sudo pip install web3 The directory '/home/chris/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing

尝试从pip安装web3时出现以下问题:

$ sudo pip install web3
The directory '/home/chris/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/chris/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting web3
  Downloading https://files.pythonhosted.org/packages/96/76/6313b5d55edb5ac6fdbde9beacafefb04fccd692348ed2085856c95dda25/web3-4.1.0.tar.gz (85kB)
    100% |████████████████████████████████| 92kB 1.4MB/s 
Collecting cytoolz<1.0.0,>=0.9.0 (from web3)
  Downloading https://files.pythonhosted.org/packages/36/f4/9728ba01ccb2f55df9a5af029b48ba0aaca1081bbd7823ea2ee223ba7a42/cytoolz-0.9.0.1.tar.gz (443kB)
    100% |████████████████████████████████| 450kB 3.6MB/s 
Collecting eth-abi<2,>=1.0.0 (from web3)
  Downloading https://files.pythonhosted.org/packages/8d/f1/212b138e8e2e46788054b456a068ae060f07464fd03f5f7ec0eb749c35d0/eth-abi-1.0.0.tar.gz
Collecting eth-account==0.1.0-alpha.2 (from web3)
  Downloading https://files.pythonhosted.org/packages/57/8e/12a906f171f2860c0baf0f07bde4d7b390a3eacb29adc8341c7bbec356f6/eth-account-0.1.0a2.tar.gz
Collecting eth-utils<2.0.0,>=1.0.1 (from web3)
  Downloading https://files.pythonhosted.org/packages/6f/08/0787c6ccb1b8dca4a15c12f67ed3d383f9f361eeb1836d6fe698caf46bca/eth-utils-1.0.3.tar.gz
Collecting hexbytes<1.0.0,>=0.1.0 (from web3)
  Downloading https://files.pythonhosted.org/packages/81/15/fcd3a5ad583673ce52f0aac8e1246b91e7c88acbeae47863c30bfb264436/hexbytes-0.1.0.tar.gz
    Complete output from command python setup.py egg_info:
    zip_safe flag not set; analyzing archive contents...
    pypandoc.__init__: module references __file__

    Installed /tmp/pip-install-KPGcEs/hexbytes/.eggs/pypandoc-1.4-py2.7.egg
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-KPGcEs/hexbytes/setup.py", line 67, in <module>
        'Programming Language :: Python :: Implementation :: PyPy',
      File "/usr/local/lib/python2.7/dist-packages/setuptools/__init__.py", line 129, in setup
        return distutils.core.setup(**attrs)
      File "/usr/lib/python2.7/distutils/core.py", line 111, in setup
        _setup_distribution = dist = klass(attrs)
      File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line 372, in __init__
        _Distribution.__init__(self, attrs)
      File "/usr/lib/python2.7/distutils/dist.py", line 287, in __init__
        self.finalize_options()
      File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line 528, in finalize_options
        ep.load()(self, ep.name, value)
      File "/tmp/pip-install-KPGcEs/hexbytes/.eggs/setuptools_markdown-0.2-py2.7.egg/setuptools_markdown.py", line 22, in long_description_markdown_filename
        output = pypandoc.convert(markdown_filename, 'rst')
      File "/tmp/pip-install-KPGcEs/hexbytes/.eggs/pypandoc-1.4-py2.7.egg/pypandoc/__init__.py", line 66, in convert
        raise RuntimeError("Format missing, but need one (identified source as text as no "
    RuntimeError: Format missing, but need one (identified source as text as no file with that name was found).

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-KPGcEs/hexbytes/

你知道是什么导致了这个问题,或者如何解决它吗?

我通过将
web3==4.1.0
移动到
requirements.txt
文件并运行
pip install-r requirements.txt
解决了这个问题

不知道为什么会起作用。但是,在尝试从
setup.py
文件安装时,它仍然失败


顺便说一句,根据
web3
的说法,它们只支持python 3.5+。

依赖项(
pypandoc
)的安装失败。准确地说,
pypandoc
在安装
hexbytes
的过程中未能转换某些内容。您是如何解决这个问题的?您是如何使用“pip”来安装Python3软件包的,您不应该使用“pip3”吗?@walksignison,正如我所说,当我使用命令
pip install-r requirements.txt从
requirements.txt
安装Python3软件包时,它会工作。我不需要使用
pip3
,因为我使用的是一个virtualenv,默认值是
python3
pip3
。明白了,我也使用了virtualenv!无论如何谢谢你
from web3 import Web3, KeepAliveRPCProvider, IPCProvider
ImportError: cannot import name Web3