如何使用 sudo pip3 install --target 安装包并识别依赖项

如何使用 sudo pip3 install --target 安装包并识别依赖项

我想使用 pip3 安装 rise 包。我使用以下命令

sudo pip3 install rise

然后 rise 包就安装在 /usr/local/lib/python3.5/dist-packages 里,并打印出来:

Collecting rise
Downloading rise-4.0.0b1-py2.py3-none-any.whl (359kB)
100% |████████████████████████████████| 368kB 4.0MB/s 
Requirement already satisfied (use --upgrade to upgrade): notebook>=4.2 in /usr/lib/python3/dist-packages (from rise)
Installing collected packages: rise
Successfully installed rise

现在我想在不同的目录中安装 rise,所以我写

sudo pip3 install --target /usr/lib/python3/dist-packages rise

然后打印出:

Collecting rise
Downloading rise-4.0.0b1-py2.py3-none-any.whl (359kB)
100% |████████████████████████████████| 368kB 4.8MB/s 
Collecting notebook>=4.2 (from rise)
Downloading notebook-4.2.2-py2.py3-none-any.whl (6.7MB)
100% |████████████████████████████████| 6.7MB 290kB/s 
Collecting nbconvert (from notebook>=4.2->rise)
Downloading nbconvert-4.2.0-py2.py3-none-any.whl (319kB)
100% |████████████████████████████████| 327kB 5.8MB/s 
Collecting ipython-genutils (from notebook>=4.2->rise)
Downloading ipython_genutils-0.1.0-py2.py3-none-any.whl
Collecting jupyter-client (from notebook>=4.2->rise)
Downloading jupyter_client-4.3.0-py2.py3-none-any.whl (76kB)
100% |████████████████████████████████| 81kB 16.0MB/s 

因为我已经通过 apt-get 安装了 notebook nbconvert 和其他依赖项,它们满足版本要求。为什么 pip3 需要重新安装它们?但在第一种情况下,没有 --target,pip3 可以识别所有依赖项。另外,如果我只使用

pip3 install rise

pip3 也不能识别所有的依赖包,会把所有依赖包都下载下来。请问 pip3 默认的依赖包搜索路径是啥?如果 pip3 不能识别依赖包搜索路径,该如何判断?

相关内容