脚本宝典收集整理的这篇文章主要介绍了pip,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
Commands 包括 install、download、uninstall、list 等
options 一般有 -h 、-V 等
PyPi 是 Python Package Index 的首字母简写,表示的是 Python 的官方索引
[options]
① -r, --requirement <file>
从给定的需求文件安装
比如:pip install -r requirements.txt
,表示从 requirements.txt
中下载全部包
② -e, --edITable <path/url>
从本地项目路径或 VCS url 安装项目
比如:pip install -e .
,表示从 set.py
中下载全部包
③ -U, --upgrade
将所有指定的软件包升级到最新的可用版本
比如:pip install pip -U
,表示升级 pip 到最新的版本
④ -i, --index-url <url>
Python 包索引的基本 URL(默认为 https://pypi.org/simple )
比如:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package
,表示从清华源镜像下载包
注意:
set.py
SETUP.py
与 requirements.txt
区别,参考文章
个人理解:还是不太懂二者的区别,最好都写上吧~setup.py
与 setup.CFg
,比如 manim 项目中使用到了,参考文章
个人理解:在 manim 项目中,setup.py
、 setup.cfg
和 requirements.txt
分别如下:# setup.py
import setuptools
setuptools.setup()
# setup.cfg
[metadata]
name = manimgl
version = 1.1.1
author = Grant Sanderson
author_email= grant@3blue1brown.COM
description = Animation engine for explanatory math videos
long_description = file: README.md
long_description_content_tyPE = text/markdown; charset=UTF-8
home_page = https://github.com/3b1b/manim
PRoject_urls =
Bug Tracker = https://github.com/3b1b/manim/issues
Documentation = https://3b1b.github.io/manim/
Source Code = https://github.com/3b1b/manim
license = MIT
[options]
packages = find:
include_package_data=True
install_requires =
argparse
colour
numpy
Pillow
scipy
sympy
tqdm
mapbox-earcut
matplotlib
moderngl
moderngl_window
pydub
pyyaML
screeninfo
pyreadline; Sys_platform == 'win32'
validators
ipython
PyOpenGL
manimpango>=0.2.0,<0.4.0
[options.entry_points]
console_scripts =
manimgl = manimlib.__main__:main
manim-render = manimlib.__main__:main
# requirements.txt
argparse
colour
numpy
Pillow
scipy
sympy
tqdm
mapbox-earcut
matplotlib
moderngl
moderngl_window
pydub
pygments
pyyaml
screeninfo
pyreadline; sys_platform == 'win32'
validators
ipython
PyOpenGL
manimpango>=0.2.0,<0.4.0
可以看出 setup.py
就短短两行,这实际上是 SETUP.CFG-ONLY 项目 的方法,可以使具体内容都放在 setup.cfg
中,而 setup.cfg
原本的作用就是对 setup.py
的修订与补充;同时可以看出 requirements.txt
和 setup.cfg
的 install_requires 一模一样,这就说明 setup.py
与 requirements.txt
本质没什么区别,在实际项目中也最好这样写;至于每种文件的格式就自行查询了
pip install -e .
,这样可以有效避免直接 pip 导致所需环境可能没成型以上是脚本宝典为你收集整理的pip全部内容,希望文章能够帮你解决pip所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。