{"id":573,"date":"2018-04-24T00:22:36","date_gmt":"2018-04-23T16:22:36","guid":{"rendered":"https:\/\/vinta.ws\/code\/?p=573"},"modified":"2026-02-18T01:20:35","modified_gmt":"2026-02-17T17:20:35","slug":"pipenv-and-pipfile-the-officially-recommended-python-packaging-tool","status":"publish","type":"post","link":"https:\/\/vinta.ws\/code\/pipenv-and-pipfile-the-officially-recommended-python-packaging-tool.html","title":{"rendered":"Pipenv and Pipfile: The officially recommended Python packaging tool"},"content":{"rendered":"<p>You no longer need to use <code>pip<\/code> and <code>virtualenv<\/code> separately. Use <code>pipenv<\/code> instead.<\/p>\n<p>ref:<br \/>\n<a href=\"https:\/\/github.com\/pypa\/pipenv\">https:\/\/github.com\/pypa\/pipenv<\/a><br \/>\n<a href=\"https:\/\/pipenv.kennethreitz.org\/en\/latest\/\">https:\/\/pipenv.kennethreitz.org\/en\/latest\/<\/a><\/p>\n<h2>Install<\/h2>\n<pre class=\"line-numbers\"><code class=\"language-console\">$ pip install pipenv<\/code><\/pre>\n<p>ref:<br \/>\n<a href=\"https:\/\/pipenv.kennethreitz.org\/en\/latest\/install\/#installing-pipenv\">https:\/\/pipenv.kennethreitz.org\/en\/latest\/install\/#installing-pipenv<\/a><\/p>\n<h2>Usage<\/h2>\n<pre class=\"line-numbers\"><code class=\"language-console\">$ pyenv global 3.7.4\n\n# initialize project virtualenv with a specific Python version\n# automatically generate both Pipfile and Pipfile.lock from requirements.txt if it exists\n$ pipenv --three\n\n$ cd \/path\/to\/project-contains-Pipfile\n$ pipenv install\n\n$ pipenv install pangu\n$ pipenv install -r requirements.txt\n\n# install packages to dev-packages\n$ pipenv install --dev \nautopep8 \nflake8 \nflake8-bandit \nflake8-blind-except \nflake8-bugbear \nflake8-builtins \nflake8-comprehensions \nflake8-debugger \nflake8-mutable \nflake8-pep3101 \nflake8-print \nflake8-string-format \nipdb \njedi \nmypy \npep8-naming \nptvsd \npylint \npylint-celery \npylint-common \npylint-flask \npytest \nwatchdog\n\n# switch your shell environment to project virtualenv\n$ pipenv shell\n$ exit\n\n# uninstall everything\n$ pipenv uninstall --all\n\n# remove project virtualenv\n$ pipenv --rm<\/code><\/pre>\n<p>ref:<br \/>\n<a href=\"https:\/\/pipenv.kennethreitz.org\/en\/latest\/install\/\">https:\/\/pipenv.kennethreitz.org\/en\/latest\/install\/<\/a><\/p>\n<h3>Example Pipfile<\/h3>\n<pre class=\"line-numbers\"><code class=\"language-toml\">[[source]]\nurl = \"https:\/\/pypi.python.org\/simple\" \nverify_ssl = true \nname = \"pypi\" \n\n[requires] \npython_version = \"3.7\"\n\n[packages] \ncelery = \"==4.2.1\"\nflask = \"==1.0.2\"\nrequests = \"&gt;=2.0.0\" \n\n[dev-packages] \nflake8 = \"*\" \nipdb = \"*\" \npylint = \"*\" \n\n[scripts]\nweb = \"python -m flask run -h 0.0.0.0\"\nworker = \"celery -A app:celery worker --pid= -l info -E --purge\"\nscheduler = \"celery -A app:celery beat -l info --pid=\"\nshell = \"flask shell\"<\/code><\/pre>\n<p>ref:<br \/>\n<a href=\"https:\/\/pipenv.kennethreitz.org\/en\/latest\/basics\/#example-pipfile-pipfile-lock\">https:\/\/pipenv.kennethreitz.org\/en\/latest\/basics\/#example-pipfile-pipfile-lock<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>You no longer need to use pip and virtualenv separately. Use pipenv instead.<\/p>\n","protected":false},"author":1,"featured_media":574,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[51,2],"class_list":["post-573","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-about-python","tag-env","tag-python"],"_links":{"self":[{"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/posts\/573","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/comments?post=573"}],"version-history":[{"count":0,"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/posts\/573\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/media\/574"}],"wp:attachment":[{"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/media?parent=573"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/categories?post=573"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/vinta.ws\/code\/wp-json\/wp\/v2\/tags?post=573"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}