pipenv 都包含什么?

pipenv 是 Pipfile 主要倡导者、requests 作者 Kenneth Reitz 写的一个命令行工具,主要包含了Pipfile、pip、click、requests和virtualenv。Pipfile和pipenv本来都是Kenneth Reitz的个人项目,后来贡献给了pypa组织。Pipfile是社区拟定的依赖管理文件,用于替代过于简陋的 requirements.txt 文件。

Pipfile的基本理念是:

Pipfile 文件是 TOML 格式而不是 requirements.txt 这样的纯文本。
一个项目对应一个 Pipfile,支持开发环境与正式环境区分。默认提供 default 和 development 区分。
提供版本锁支持,存为 Pipfile.lock。
click是Flask作者 Armin Ronacher 写的命令行库,现在Flask已经集成了它。

接下来,我们看看怎么使用它吧

安装和使用

安装

pip install pipenv

用法

 进入当前项目文件夹目录:

pipenv --three 会使用当前系统的Python3创建环境

pipenv --python 3.6 指定某一Python版本创建环境

pipenv shell 激活虚拟环境

pipenv --where 显示目录信息
/home/jiahuan/pipenvtest pipenv --venv 显示虚拟环境信息
/home/jiahuan/.local/share/virtualenvs/pipenvtest-9KKRH3OW pipenv --py 显示Python解释器信息
/home/jiahuan/.local/share/virtualenvs/pipenvtest-9KKRH3OW/bin/python pipenv install requests 安装相关模块并加入到Pipfile pipenv install django==1.11 安装固定版本模块并加入到Pipfile pipenv graph 查看目前安装的库及其依赖 requests==2.18.4
- certifi [required: >=2017.4.17, installed: 2017.11.5]
- chardet [required: <3.1.0,>=3.0.2, installed: 3.0.4]
- idna [required: >=2.5,<2.7, installed: 2.6]
- urllib3 [required: >=1.21.1,<1.23, installed: 1.22]

pipenv check检查安全漏洞
 - Checking PEP 508 requirements…
 - Passed!
 - Checking installed package safety…
 - All good!

pipenv uninstall --all 卸载全部包并从Pipfile中移除
pipenv run python manage.py runserver 运行Py文件
alias prp="pipenv run python"

其他命令

E:\python\机器学习和深度学习\深度学习\自然语言处理\lstm-crf\zh-NER-TF>pipenv --help
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. Usage Examples:
Create a new project using Python 3.7, specifically:
$ pipenv --python 3.7 Remove project virtualenv (inferred from current directory):
$ pipenv --rm Install all dependencies for a project (including dev):
$ pipenv install --dev Create a lockfile containing pre-releases:
$ pipenv lock --pre Show a graph of your installed dependencies:
$ pipenv graph Check your installed dependencies for security vulnerabilities:
$ pipenv check Install a local setup.py into your virtual environment/Pipfile:
$ pipenv install -e . Use a lower-level pip command:
$ pipenv run pip freeze Commands:
check Checks for security vulnerabilities and against PEP 508 markers
provided in Pipfile.
clean Uninstalls all packages not specified in Pipfile.lock.
graph Displays currently-installed dependency graph information.
install Installs provided packages and adds them to Pipfile, or (if no
packages are given), installs all packages from Pipfile.
lock Generates Pipfile.lock.
open View a given module in your editor.
run Spawns a command installed into the virtualenv.
shell Spawns a shell within the virtualenv.
sync Installs all packages specified in Pipfile.lock.
uninstall Un-installs a provided package and removes it from Pipfile.
update Runs lock, then sync.

注:pipenv install 安装模块时有时候会很慢

可以设置国内源:Pipfile文件中[source]下面url属性,比如修改成:url = "https://pypi.tuna.tsinghua.edu.cn/simple"

国内镜像源的选择

阿里云:http://mirrors.aliyun.com/pypi/simple/
豆瓣:http://pypi.douban.com/simple/
清华大学:https://pypi.tuna.tsinghua.edu.cn/simple/
中国科学技术大学:https://pypi.mirrors.ustc.edu.cn/simple/

  

包管理工具之Pipenv的更多相关文章

  1. Python | Pipenv官方推荐的python包管理工具

    原文地址:https://cloud.tencent.com/developer/article/1355672 Pipenv - 官方推荐的的python包管理工具. Pipenv是一款旨在将所有包 ...

  2. python版本管理工具pyenv和包管理工具pipenv

    一.pyenv版本管理工具 pyenv是一个python版本管理工具,可以实现轻松切换多个python版本 它可根据每个用户更改全局python版本,也可以为每个项目指定python版本,还可以管理v ...

  3. Python黑帽编程1.3 Python运行时与包管理工具

    Python黑帽编程1.3  Python运行时与包管理工具 0.1  本系列教程说明 本系列教程,采用的大纲母本为<Understanding Network Hacks Attack and ...

  4. 包管理工具Carthage使用

    iOS项目中第三方开源库的工具有Cocoapods和Carthage,swift官方出了一个包管理工具SPM(Swift Package Manager). 首先,大体讲一下Cocoapods和Car ...

  5. Node包管理工具

    Node包管理工具 只是简单的介绍一些工具的使用,有利于开发过程.除了介绍Node包管理工具,还介绍了前端打包工具,前端模块管理工具 Node包管理工具:    --npm    --cnpm    ...

  6. godep 包管理工具

    godep是解决包依赖的管理工具 安装 go get github.com/tools/godep 成功安装后,在GOPATH的bin目录下会有一个godep可执行的二进制文件,后面执行的命令都是用这 ...

  7. 【转载】Python的包管理工具Pip

    接触了Ruby,发现它有个包管理工具RubyGem很好用,并且有很完备的文档系统http://rdoc.info 发现Python下也有同样的工具,包括easy_install和Pip.不过,我没有细 ...

  8. Python的包管理工具Pip (zz )

    Python的包管理工具Pip 接触了Ruby,发现它有个包管理工具RubyGem很好用,并且有很完备的文档系统http://rdoc.info 发现Python下也有同样的工具,包括easy_ins ...

  9. python 包管理工具

    python 包管理工具 Python当前的包管理工具链是 easy_install/pip + distribute/setuptools + distutils,显得较为混乱. 而将来的工具链组合 ...

随机推荐

  1. 深入理解Mysql索引的底层数据结构 B+ Tree (1)

    关键字的个数等于路的个数减1. 一个二叉树节点可以存储4kb大小的数据,假如关键字是整型的一个关键字占用4byte,其他数据冗余4个字节 4 kb = 4*1024 byte = 4096 byte. ...

  2. 安装ESXi部署OVF详细步骤

    整个安装部署过程均在个人环境进行.欧克,我们现在开始. 一.安装ESXi 1.Enter回车 2.Enter回车继续 3.F11,接受继续 4.Enter,回车继续(选择安装ESXi的设备) 5.默认 ...

  3. 树莓派Ubuntu 16.04 MATA系统 修改用户文件夹名后,提示configure it with blueman-service

    自从修改了树莓派的Ubuntu 16.04 MATA 系统的 /home/ 下的用户文件夹名后,使用vncserver远程操作,看到桌面每次都提示 Configured directory for i ...

  4. zabbix监控Oracle

    可监控项 使用zabbix监控oracle数据库需要借助第三方的插件,目前使用较多的是orabbix.目前维护到了1.2.3版本.关于oracle自带的监控项目有以下几个: DB Version (i ...

  5. 周末班:Python基础之并发编程

    进程 相关概念 进程 进程(Process)是计算机中的程序关于某数据集合上的一次运行活动,是系统进行资源分配和调度的基本单位,是操作系统结构的基础.在早期面向进程设计的计算机结构中,进程是程序的基本 ...

  6. Linux定是调用shell脚本删除文件

    编写脚本 vi delbak.sh 代码如下: #!/bin/sh location="/home/mysql/backup/" find $location -mtime +7 ...

  7. Vue SSR: 基本用法 (二)

    上一篇讲解了ssr的原理,这篇主要讲基本用法: 1.安装 npm install vue vue-server-renderer --save 我们将在整个指南中使用 NPM,但你也可以使用 Yarn ...

  8. 最小化spring XML配置,Spring提供了4种自动装配策略。

    1.ByName自动装配:匹配属性的名字 在配置文件中的写法: <bean name="course" class="course类的全包名">&l ...

  9. 文本分类实战(四)—— Bi-LSTM模型

    1 大纲概述 文本分类这个系列将会有十篇左右,包括基于word2vec预训练的文本分类,与及基于最新的预训练模型(ELMo,BERT等)的文本分类.总共有以下系列: word2vec预训练词向量 te ...

  10. 移动端无限滚动 TScroll.vue组件

    // 先看使用TScroll.vue的几个demo 1.https://sorrowx.github.io/TScroll/#/ 2. https://sorrowx.github.io/TScrol ...