[英]What is the difference between `pip install package` and `python -m pip install package`?
[英]What is the difference between 'pip install <package>' and 'python -m pip install <package>'?
pip install...
调用pip
可执行文件,该可执行文件必须在您的路径中。 python -m pip...
the pip application that corresponds to this python installation (ie Python will use its normal import mechanism to resolve the pip
package).
通常这两种方法是相同的,但是想想alias pip=echo
之后会发生什么; python -m pip...
方法仍然有效。
For example you can use the python -m pip...
approach if you're inside a virtual environment, but you want to install a package into another Python installation:
(somevenv) $ pip install ... # installs into 'somevenv'
(somevenv) $ /path/to/othervenv/bin/python -m pip install ... # installs into 'othervenv'
In the end, python -m pip...
is always going to use the 'correct' installation of Python, assuming that you intended to use whatever python
points to.
如果要从运行脚本中安装分发,则根据pip 文档,使用python -m pip
方法也是首选方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.