pip安装失败,如何解决?

时间:2020-04-20 19:00:47

标签: python linux python-2.7 pip

对于大多数问题,我都会遇到如下错误。

    raise DistutilsError(str(e))

distutils.errors.DistutilsError: Command '['/usr/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpLgEDX8', '--quiet', 'cffi!=1.11.3,>=1.8']' returned non-zero exit status 2

----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-ZK7i4M-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/cryptography
Storing debug log for failure in /home/vagrant/.pip/pip.log

cat /home/vagrant/.pip/pip.log

le/cffi/), version 1.5.2 doesn't match >=1.8,!=1.11.3
  Ignoring link https://files.pythonhosted.org/packages/b6/98/11feff87072e2e640fb8320712b781eccdef05d588618915236b32289d5a/cffi-1.6.0.tar.gz#sha256=a7f75c4ef2362c0a0e54657add0a6c509fecbfa3b3807bc0925f5cb1c9f927db (from https://pypi.org/simple/cffi/), version 1.6.0 doesn't match >=1.8,!=1.11.3
  Ignoring link https://files.pythonhosted.org/packages/83/3c/00b553fd05ae32f27b3637f705c413c4ce71290aa9b4c4764df694e906d9/cffi-1.7.0.tar.gz#sha256=6ed5dd6afd8361f34819c68aaebf9e8fc12b5a5893f91f50c9e50c8886bb60df (from https://pypi.org/simple/cffi/), version 1.7.0 doesn't match >=1.8,!=1.11.3
  Ignoring link https://files.pythonhosted.org/packages/62/ea/f41d44e0a4222fe8317ffe1fe7a5c75ec71ca233b4067850567922f8b7be/cffi-1.11.3.tar.gz#sha256=8456abb0f892eb7d545f9ce94f4ba78d651365b1a59f9ce9ae7b5325a95dc698 (from https://pypi.org/simple/cffi/), version 1.11.3 doesn't match >=1.8,!=1.11.3
  Using version 1.14.0 (newest of versions: 1.14.0, 1.13.2, 1.13.1, 1.13.0, 1.12.3, 1.12.2, 1.12.1, 1.12.0, 1.11.5, 1.11.4, 1.11.2, 1.11.1, 1.11.0, 1.10.0, 1.9.1, 1.9.0, 1.8.3, 1.8.2)
  Downloading from URL https://files.pythonhosted.org/packages/05/54/3324b0c46340c31b909fcec598696aaec7ddc8c18a63f2db352562d3354c/cffi-1.14.0.tar.gz#sha256=2d384f4a127a15ba701207f7639d94106693b6cd64173d6c8988e2c25f3ac2b6 (from https://pypi.org/simple/cffi/)
  Running setup.py (path:/tmp/pip_build_root/cffi/setup.py) egg_info for package cffi
    /usr/local/lib/python2.7/dist-packages/pkg_resources/py2_warn.py:21: UserWarning: Setuptools will stop working on Python 2
    ************************************************************
    You are running Setuptools on Python 2, which is no longer
    supported and
    >>> SETUPTOOLS WILL STOP WORKING <<<
    in a subsequent release (no sooner than 2020-04-20).
    Please ensure you are installing
    Setuptools using pip 9.x or later or pin to `setuptools<45`
    in your environment.
    If you have done those things and are still encountering
    this message, please follow up at

    ************************************************************
      sys.version_info < (3,) and warnings.warn(pre + "*" * 60 + msg + "*" * 60)
    running egg_info
    creating pip-egg-info/cffi.egg-info
    /tmp/pip_build_root/cffi/setup.py:12: PkgResourcesDeprecationWarning: Parameters to load are deprecated.  Call .resolve and .require separately.
      include_dirs = ['/usr/include/ffi',
    writing requirements to pip-egg-info/cffi.egg-info/requires.txt
    writing pip-egg-info/cffi.egg-info/PKG-INFO
    writing top-level names to pip-egg-info/cffi.egg-info/top_level.txt
    writing dependency_links to pip-egg-info/cffi.egg-info/dependency_links.txt
    writing entry points to pip-egg-info/cffi.egg-info/entry_points.txt
    writing manifest file 'pip-egg-info/cffi.egg-info/SOURCES.txt'
    reading manifest file 'pip-egg-info/cffi.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'pip-egg-info/cffi.egg-info/SOURCES.txt'
  Source in /tmp/pip_build_root/cffi has version 1.14.0, which satisfies requirement cffi!=1.11.3,>=1.8 (from cryptography)
Downloading/unpacking pycparser (from cffi!=1.11.3,>=1.8->cryptography)
  Getting page https://pypi.python.org/simple/pycparser/
  URLs to search for versions for pycparser (from cffi!=1.11.3,>=1.8->cryptography):
  * https://pypi.python.org/simple/pycparser/
  Analyzing links from page https://pypi.org/simple/pycparser/
    Found link https://files.pythonhosted.org/packages/55/cb/7effa342d199085ef53557359edc398582b2237751435d9175107c585a10/pycparser-2.02.zip#sha256=66aaba8a6b75c089956102f583219727639d2c79cb636f37730332f711247881 (from https://pypi.org/simple/pycparser/), version: 2.02
    Found link https://files.pythonhosted.org/packages/a0/87/5b1937f15a2137797cf061c133b3b5fb396896ab1733465cd9a8cc91f04b/pycparser-2.03.zip#sha256=5d45039bb4ce1f942d73a91b1b33a22aef0bdbee6a332d1934f81b7219b88e85 (from https://pypi.org/simple/pycparser/), version: 2.03
    Found link https://files.pythonhosted.org/packages/d9/b8/e4a76abd3c4cd4384a62f679e0ed39c4c10fa0f36e64cb96227fec1b0546/pycparser-2.04.zip#sha256=490093c52dfca678b73179e90cc2f461fafc1ad2c672e3b17f5438a6c9c1d579 (from https://pypi.org/simple/pycparser/), version: 2.04
    Found link https://files.pythonhosted.org/packages/f0/20/1f6094ff621b0ea9df5786cc28067b4ba1c15c50adc0d7855add89a30801/pycparser-2.05.zip#sha256=83e35b9f7d14f5f3f71698c991853b27ceab7c6d49f7faef97ba289fb0620f65 (from https://pypi.org/simple/pycparser/), version: 2.05
    Found link https://files.pythonhosted.org/packages/62/e9/93be808d895a9b71ba3980a2bda4319240cfccaaeabb0139c04d7f7fe0fe/pycparser-2.06.tar.gz#sha256=fcf9f043bc642d61ddedb40900ea201257e54d74eaa0df6b7a3fffc989c6ed49 (from https://pypi.org/simple/pycparser/), version: 2.06
    Found link https://files.pythonhosted.org/packages/55/6f/3889d832463e8b08ec1ad5ca98069975b231accbe09092b671e530be8980/pycparser-2.07.tar.gz#sha256=ab1d0422a58c95d6511e33c1f8d3f36169c70a3158f0867342dc7e359e1889e1 (from https://pypi.org/simple/pycparser/), version: 2.07
    Found link https://files.pythonhosted.org/packages/64/4e/e8a22c36881b407d60d11cfd77a470d8e2004e85e410383d07492cf57c7d/pycparser-2.08.tar.gz#sha256=48165dbc4738973cff67d2986e22013d78634df2dcdf58b57a1e341cc34ef028 (from https://pypi.org/simple/pycparser/), version: 2.08
    Found link https://files.pythonhosted.org/packages/12/96/91d469b9fe316ddd6ed337bc28b394327e3b18b0549b59c484f77c9e141b/pycparser-2.09.tar.gz#sha256=907a32d5affc8ef649581633053350360d75bab5e6a5cfd4dbe3fa8de9142ffe (from https://pypi.org/simple/pycparser/), version: 2.09
    Found link https://files.pythonhosted.org/packages/82/b9/0fe7062d85440ea77226a0c2eaafb0ec313dde2e08e988b360bba3fc5b75/pycparser-2.09.1.tar.gz#sha256=6d5f5d70b2edf7bc43a3ab855511bff16e10e5b0b353fd31686284acab898102 (from https://pypi.org/simple/pycparser/), version: 2.09.1
    Found link https://files.pythonhosted.org/packages/18/e2/32e2457514b32ded24f2ebecfca3866ce08203e8cfeec18f9535f14ef374/pycparser-2.10.tar.gz#sha256=957d98b661c0b64b580ab6f94b125e09b6714154ee51de40bca16d3f0076b86c (from https://pypi.org/simple/pycparser/), version: 2.10
    Found link https://files.pythonhosted.org/packages/1f/66/23f8e517056c7dc7893314d67d1b3105f0e011538cfd4c8348e24818ac08/pycparser-2.11.tar.gz#sha256=702c37484ef8bc224b3098daf4f00cfa6621dbb60ded875cfc327e3f09ee2dfc (from https://pypi.org/simple/pycparser/), version: 2.11
    Found link https://files.pythonhosted.org/packages/96/af/b1b93ac53810645cf945050bd0c64a5ab1a510179f0e9e9f2d55faeef142/pycparser-2.12.tar.gz#sha256=da24c80aeb3c794ac64fe5503a01f65f13fece3e02513fd2e0761f93c96597b0 (from https://pypi.org/simple/pycparser/), version: 2.12
    Found link https://files.pythonhosted.org/packages/95/e0/2750d501c7e729a0a37dbe0fe0f5ce1e642cea12bc7cdf6d85b9a5abfea3/pycparser-2.13.tar.gz#sha256=b399599a8a0e386bfcbc5e01a38d79dd6e926781f9e358cd5512f41ab7d20eb7 (from https://pypi.org/simple/pycparser/), version: 2.13
    Found link https://files.pythonhosted.org/packages/6d/31/666614af3db0acf377876d48688c5d334b6e493b96d21aa7d332169bee50/pycparser-2.14.tar.gz#sha256=7959b4a74abdc27b312fed1c21e6caf9309ce0b29ea86b591fd2e99ecdf27f73 (from https://pypi.org/simple/pycparser/), version: 2.14
    Found link https://files.pythonhosted.org/packages/37/05/65d342ba500c6f9dbb1978e9dd01a1097530e0291003638bbef329ad4522/pycparser-2.15.tar.gz#sha256=457393eb49a0cc1099e67097f3bd73d28f63e76f032dc9eef9d79780120b1b8d (from https://pypi.org/simple/pycparser/), version: 2.15
    Found link https://files.pythonhosted.org/packages/eb/83/00c55ff5cb773a78e9e47476ac1a0cd2f0fb71b34cb6e178572eaec22984/pycparser-2.16.tar.gz#sha256=108f9ff23869ae2f8b38e481e7b4b4d4de1e32be968f29bbe303d629c34a6260 (from https://pypi.org/simple/pycparser/), version: 2.16
    Found link https://files.pythonhosted.org/packages/be/64/1bb257ffb17d01f4a38d7ce686809a736837ad4371bcc5c42ba7a715c3ac/pycparser-2.17.tar.gz#sha256=0aac31e917c24cb3357f5a4d5566f2cc91a19ca41862f6c3c22dc60a629673b6 (from https://pypi.org/simple/pycparser/), version: 2.17
    Found link https://files.pythonhosted.org/packages/8c/2d/aad7f16146f4197a11f8e91fb81df177adcc2073d36a17b1491fd09df6ed/pycparser-2.18.tar.gz#sha256=99a8ca03e29851d96616ad0404b4aad7d9ee16f25c9f9708a11faf2810f7b226 (from https://pypi.org/simple/pycparser/), version: 2.18
    Found link https://files.pythonhosted.org/packages/68/9e/49196946aee219aead1290e00d1e7fdeab8567783e83e1b9ab5585e6206a/pycparser-2.19.tar.gz#sha256=a988718abfad80b6b157acce7bf130a30876d27603738ac39f140993246b25b3 (from https://pypi.org/simple/pycparser/), version: 2.19
    Found link https://files.pythonhosted.org/packages/ae/e7/d9c3a176ca4b02024debf82342dab36efadfc5776f9c8db077e8f6e71821/pycparser-2.20-py2.py3-none-any.whl#sha256=7582ad22678f0fcd81102833f60ef8d0e57288b6b5fb00323d101be910e35705 (from https://pypi.org/simple/pycparser/), version: 2.20
    Found link https://files.pythonhosted.org/packages/0f/86/e19659527668d70be91d0369aeaa055b4eb396b0f387a4f92293a20035bd/pycparser-2.20.tar.gz#sha256=2d475327684562c3a96cc71adf7dc8c4f0565175cf86b6d7a404ff4c771f15f0 (from https://pypi.org/simple/pycparser/), version: 2.20
  Using version 2.20 (newest of versions: 2.20, 2.20, 2.19, 2.18, 2.17, 2.16, 2.15, 2.14, 2.13, 2.12, 2.11, 2.10, 2.09.1, 2.09, 2.08, 2.07, 2.06, 2.05, 2.04, 2.03, 2.02)
  Downloading from URL https://files.pythonhosted.org/packages/ae/e7/d9c3a176ca4b02024debf82342dab36efadfc5776f9c8db077e8f6e71821/pycparser-2.20-py2.py3-none-any.whl#sha256=7582ad22678f0fcd81102833f60ef8d0e57288b6b5fb00323d101be910e35705 (from https://pypi.org/simple/pycparser/)
Installing collected packages: cryptography, cffi, pycparser
  Running setup.py install for cryptography
    Running command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-ZK7i4M-record/install-record.txt --single-version-externally-managed --compile
    /usr/local/lib/python2.7/dist-packages/pkg_resources/py2_warn.py:21: UserWarning: Setuptools will stop working on Python 2
    ************************************************************
    You are running Setuptools on Python 2, which is no longer
    supported and
    >>> SETUPTOOLS WILL STOP WORKING <<<
    in a subsequent release (no sooner than 2020-04-20).
    Please ensure you are installing
    Setuptools using pip 9.x or later or pin to `setuptools<45`
    in your environment.
    If you have done those things and are still encountering
    this message, please follow up at

    ************************************************************
      sys.version_info < (3,) and warnings.warn(pre + "*" * 60 + msg + "*" * 60)

    Usage:
      /usr/bin/python -m pip <command> [options]

    no such option: --disable-pip-version-check
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip_build_root/cryptography/setup.py", line 274, in <module>
        **keywords_with_side_effects(sys.argv)
      File "/usr/local/lib/python2.7/dist-packages/setuptools/__init__.py", line 143, in setup
        _install_setup_requires(attrs)
      File "/usr/local/lib/python2.7/dist-packages/setuptools/__init__.py", line 138, in _install_setup_requires
        dist.fetch_build_eggs(dist.setup_requires)
      File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line 698, in fetch_build_eggs
        replace_conflicting=True,
      File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 783, in resolve
        replace_conflicting=replace_conflicting
      File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1066, in best_match
        return self.obtain(req, installer)
      File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1078, in obtain
        return installer(requirement)
      File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line 754, in fetch_build_egg
        return fetch_build_egg(self, req)
      File "/usr/local/lib/python2.7/dist-packages/setuptools/installer.py", line 130, in fetch_build_egg
        raise DistutilsError(str(e))
    distutils.errors.DistutilsError: Command '['/usr/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpLgEDX8', '--quiet', 'cffi!=1.11.3,>=1.8']' returned non-zero exit status 2
    Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-ZK7i4M-record/install-record.txt --single-version-externally-managed --compile:
    /usr/local/lib/python2.7/dist-packages/pkg_resources/py2_warn.py:21: UserWarning: Setuptools will stop working on Python 2

************************************************************

You are running Setuptools on Python 2, which is no longer

supported and

>>> SETUPTOOLS WILL STOP WORKING <<<

in a subsequent release (no sooner than 2020-04-20).

Please ensure you are installing

Setuptools using pip 9.x or later or pin to `setuptools<45`

in your environment.

If you have done those things and are still encountering

this message, please follow up at



************************************************************

  sys.version_info < (3,) and warnings.warn(pre + "*" * 60 + msg + "*" * 60)



Usage:

  /usr/bin/python -m pip <command> [options]



no such option: --disable-pip-version-check

Traceback (most recent call last):

  File "<string>", line 1, in <module>

  File "/tmp/pip_build_root/cryptography/setup.py", line 274, in <module>

    **keywords_with_side_effects(sys.argv)

  File "/usr/local/lib/python2.7/dist-packages/setuptools/__init__.py", line 143, in setup

    _install_setup_requires(attrs)

  File "/usr/local/lib/python2.7/dist-packages/setuptools/__init__.py", line 138, in _install_setup_requires

    dist.fetch_build_eggs(dist.setup_requires)

  File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line 698, in fetch_build_eggs

    replace_conflicting=True,

  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 783, in resolve

    replace_conflicting=replace_conflicting

  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1066, in best_match

    return self.obtain(req, installer)

  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 1078, in obtain

    return installer(requirement)

  File "/usr/local/lib/python2.7/dist-packages/setuptools/dist.py", line 754, in fetch_build_egg

    return fetch_build_egg(self, req)

  File "/usr/local/lib/python2.7/dist-packages/setuptools/installer.py", line 130, in fetch_build_egg

    raise DistutilsError(str(e))

distutils.errors.DistutilsError: Command '['/usr/bin/python', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpLgEDX8', '--quiet', 'cffi!=1.11.3,>=1.8']' returned non-zero exit status 2

----------------------------------------
Cleaning up...
  Removing temporary dir /tmp/pip_build_root...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-ZK7i4M-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/cryptography
Exception information:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 283, in run
    requirement_set.install(install_options, global_options, root=options.root_path)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1436, in install
    requirement.install(install_options, global_options, *args, **kwargs)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 707, in install
    cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
  File "/usr/lib/python2.7/dist-packages/pip/util.py", line 715, in call_subprocess
    % (command_desc, proc.returncode, cwd))
InstallationError: Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/cryptography/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-ZK7i4M-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/cryptography

我尝试过的命令: 须藤和没有须藤。 点安装加密 sudo pip安装markupsafe sudo pip installxmltodict sudo pip安装pywinrm

即使我尝试了以下软件包: sudo pip安装markupsafe

sudo pip installxmltodict

sudo pip安装pywinrm 点子升级也是我尝试过的。

vagrant @ ubuntu-control:〜/ ans $ lsb_release -a 没有可用的LSB模块。 发行人ID:Ubuntu 说明:Ubuntu 14.04.6 LTS 发行:14.04 代号:trusty

1 个答案:

答案 0 :(得分:1)

根据日志,看来您的pip包已过时。更新:

pip2 install --upgrade --user pip

然后您可以运行:

pip2 install --user "setuptools<45"

希望有效。