yanghx的python笔记

python的依赖管理(pipenv)

2019-10-06  本文已影响0人  asfafjwefhfuer

我只是一个初学者。这篇博客只是作为学习笔记的形式存在。

前言
在学习python这门语言时,一直对它的依赖管理有意见,感觉没有maven用着方便,现在总结一下python的依赖管理工具pipenv的用法。

资料

我理解的python的依赖管理

pip安装依赖时默认将依赖下载到$python_home/Lib/文件下。这样就会导致在新版本覆盖旧版,莫名其妙删依赖。 所以需要为每一个项目创建单独的运行环境。也就是依赖隔离(虚拟环境)。
python虚拟环境的概念是将当前系统已安装的python编译环境copy一一份。这样就实现了运行环境的互不干扰。(虽然这样把一个依赖包下载多份,会占用空间)
使用pipenv创建的虚拟环境可以通过 pipenv venv查看它的物理路径。

使用 pipenv管理python的依赖

pip install pipenv

E:\>pipenv -h
Usage: pipenv [OPTIONS] COMMAND [ARGS]...

Options:
  --where             Output project home information.
  --venv              Output virtualenv information.
  --py                Output Python interpreter information.
  --envs              Output Environment Variable options.
  --rm                Remove the virtualenv.
  --bare              Minimal output.
  --completion        Output completion (to be eval'd).
  --man               Display manpage.
  --support           Output diagnostic information for use in GitHub issues.
  --site-packages     Enable site-packages for the virtualenv.  [env var:
                      PIPENV_SITE_PACKAGES]
  --python TEXT       Specify which version of Python virtualenv should use.
  --three / --two     Use Python 3/2 when creating virtualenv.
  --clear             Clears caches (pipenv, pip, and pip-tools).  [env var:
                      PIPENV_CLEAR]
  -v, --verbose       Verbose mode.
  --pypi-mirror TEXT  Specify a PyPI mirror.
  --version           Show the version and exit.
  -h, --help          Show this message and exit.

pyCharm设置用pipenv管理依赖

常用命令

上一篇 下一篇

猜你喜欢

热点阅读