Python pip安装“DistutilsOptionError:无法将用户与前缀、exec_前缀/home或install_(plat)base组合”

2024-09-28 23:34:27 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试安装Python的cryptacular包,但始终遇到错误:

没有sudo:

$ pip install cryptacular
Collecting cryptacular
  Using cached https://files.pythonhosted.org/packages/ec/d6/a82d191ec058314b2b7cbee5635150f754ba1c6ffc05387bc9a57efe48b8/cryptacular-1.5.5.tar.gz
    Complete output from command python setup.py egg_info:
    Collecting enscons
      Using cached https://files.pythonhosted.org/packages/e3/e4/7dcc4bc0893d82479a7a8b77e19cf4bc15862962f63c4a800ac655467552/enscons-0.23.0-py2.py3-none-any.whl
    Collecting scons>=3.0.5 (from enscons)
      Using cached https://files.pythonhosted.org/packages/90/ff/01a273c627f48079285a8be6bf4aadb95d6d6c1793c114c6876fc28aab5c/scons-3.1.2-py2.py3-none-any.whl
    Collecting pytoml>=0.1 (from enscons)
      Using cached https://files.pythonhosted.org/packages/a5/47/c7f8a0f210ad18576840922e0b504f0b7f5f73aea4a52ab14c5b58517edf/pytoml-0.1.21-py2.py3-none-any.whl
    Collecting wheel (from enscons)
      Using cached https://files.pythonhosted.org/packages/81/44/db78754a73d9a88c5bd1bb692b40004410970e88aa0c5dff20b57f231505/wheel-0.34.1-py2.py3-none-any.whl
    Collecting attrs (from enscons)
      Using cached https://files.pythonhosted.org/packages/a2/db/4313ab3be961f7a763066401fb77f7748373b6094076ae2bda2806988af6/attrs-19.3.0-py2.py3-none-any.whl
    Collecting setuptools (from enscons)
      Using cached https://files.pythonhosted.org/packages/f9/d3/955738b20d3832dfa3cd3d9b07e29a8162edb480bf988332f5e6e48ca444/setuptools-44.0.0-py2.py3-none-any.whl
    Installing collected packages: scons, pytoml, wheel, attrs, setuptools, enscons
    Exception:
    Traceback (most recent call last):
      File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 215, in main
        status = self.run(options, args)
      File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 360, in run
        prefix=options.prefix_path,
      File "/usr/lib/python2.7/dist-packages/pip/req/req_set.py", line 784, in install
        **kwargs
      File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 851, in install
        self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
      File "/usr/lib/python2.7/dist-packages/pip/req/req_install.py", line 1064, in move_wheel_files
        isolated=self.isolated,
      File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 247, in move_wheel_files
        prefix=prefix,
      File "/usr/lib/python2.7/dist-packages/pip/locations.py", line 153, in distutils_scheme
        i.finalize_options()
      File "/usr/lib/python2.7/distutils/command/install.py", line 289, in finalize_options
        raise DistutilsOptionError("can't combine user with prefix, "
    DistutilsOptionError: can't combine user with prefix, exec_prefix/home, or install_(plat)base
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-pY1I05/cryptacular/setup.py", line 13, in <module>
        "-t", "setup-requires"] + requires)
      File "/usr/lib/python2.7/subprocess.py", line 190, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['/usr/bin/python', '-m', 'pip', 'install', '-t', 'setup-requires', 'enscons']' returned non-zero exit status 2

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-pY1I05/cryptacular/

现在,我尝试使用sudo,因为我不知道如何修复上述错误。但是(是的,你猜对了)我又犯了一个错误:

$ sudo pip install cryptacular
The directory '/home/bob/.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 pi
p with sudo, you may want sudo's -H flag.
The directory '/home/bob/.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 cryptacular
  Downloading https://files.pythonhosted.org/packages/ec/d6/a82d191ec058314b2b7cbee5635150f754ba1c6ffc05387bc9a57efe48b8/cryptacular-1.5.5.tar.gz
Requirement already satisfied: pbkdf2 in /usr/local/lib/python2.7/dist-packages (from cryptacular)
Requirement already satisfied: setuptools in /usr/local/lib/python2.7/dist-packages (from cryptacular)
Installing collected packages: cryptacular
  Running setup.py install for cryptacular ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-nS5oQT/cryptacular/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-u5UBdD-record/install-record.txt --single-version-externally-managed --compile:
    scons: Reading SConscript files ...
    scons: done reading SConscript files.
    scons: Building targets ...
    scons: *** Do not know how to make File target `install' (/tmp/pip-build-nS5oQT/cryptacular/install).  Stop.
    scons: building terminated because of errors.

    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-nS5oQT/cryptacular/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(co
mpile(code, __file__, 'exec'))" install --record /tmp/pip-u5UBdD-record/install-record.txt --single-version-externally-managed --compile" failed with error code 2 in /tmp/pip-build-nS5oQT/cryptacular/

我真的不知道该怎么做才能解决这个窃听问题


Tags: installpipinfrompyprefixlibpackages
1条回答
网友
1楼 · 发布于 2024-09-28 23:34:27

第一个错误是cryptacular的缺点:它尝试使用pip install -tinstall ^{},而不考虑当前的pip选项。我建议将此错误报告给the issue tracker

要解决此问题,请尝试在安装cryptacular之前手动安装enscons

pip install enscons
pip install cryptacular

第二个bug已经在11月份出现,还没有收到任何答案

相关问题 更多 >