Pip (python) differences between `--install-option='--prefix'` and `--root` and `--target`

前端 未结 1 1889
轮回少年
轮回少年 2021-02-01 15:09

The pip documentation lacks too much wordings (to my eyes), about parameters to deal with source and destinations.

I\'ve experienced strange things installing Sphinx wit

1条回答
  •  情歌与酒
    2021-02-01 15:35

    First and obvious question: why don't you just install the package from PyPI?

    sudo pip install sphinx
    

    If you want to install anything that has a setup.py file with pip you can use the --editable flag:

    -e, --editable

    Install a project in editable mode (i.e. setuptools “develop mode”) from a local project path or a VCS url.

    So you can just issue the command (prefix with sudo if necessary):

    pip3 install -e /path/to/pkg
    

    where /path/to/pkg is the directory where setup.py can be found (where you extracted the files).

    To answer the other questions:

    1. --root

      is used to change the root directory of the file system where pip should install package resources, not to change where to find the package.

    2. --target is used to tell pip in which folder to install the package.

    3. --install-option is used to set some variables that will be used by setup.py, not to change where pip should look for the file.

    0 讨论(0)
提交回复
热议问题