{"id":670,"date":"2020-10-19T04:06:07","date_gmt":"2020-10-19T04:06:07","guid":{"rendered":"https:\/\/www.pythontutorial.net\/?page_id=670"},"modified":"2025-03-30T09:42:55","modified_gmt":"2025-03-30T09:42:55","slug":"install-pipenv-windows","status":"publish","type":"page","link":"https:\/\/www.pythontutorial.net\/python-basics\/install-pipenv-windows\/","title":{"rendered":"How to Install pipenv on Windows"},"content":{"rendered":"\n<p><strong>Summary<\/strong>: in this tutorial, you&#8217;ll learn how to install the <code>pipenv<\/code> packaging tool on Windows and how to configure a project with a new virtual environment using the Python <code>pipenv<\/code> tool.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id='prerequisites'>Prerequisites <a href=\"#prerequisites\" class=\"anchor\" id=\"prerequisites\" title=\"Anchor for Prerequisites\">#<\/a><\/h2>\n\n\n\n<p>Before installing the <code>pipenv<\/code> tool, you need to have Python and <code>pip<\/code> installed on your computer.<\/p>\n\n\n\n<p>First, open the Command Prompt or Windows Powershell and type the following command.<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">python -V<\/code><\/span><\/pre>\n\n\n<p>Note that the letter <code>V<\/code> in the <code>-V<\/code> is uppercase. If you see the Python version like the following:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-tag\">Python<\/span> 3<span class=\"hljs-selector-class\">.13<\/span><span class=\"hljs-selector-class\">.2<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>&#8230;then you already have Python installed on your computer. Otherwise, you need to <a href=\"https:\/\/www.pythontutorial.net\/getting-started\/install-python\/\">install Python<\/a> first.<\/p>\n\n\n\n<p>Second, use the following command to check if you have the <code>pip<\/code> tool on your computer:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">pip -V<\/code><\/span><\/pre>\n\n\n<p>It&#8217;ll return something like this:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-tag\">pip<\/span> 25<span class=\"hljs-selector-class\">.0<\/span><span class=\"hljs-selector-class\">.1<\/span> <span class=\"hljs-selector-tag\">from<\/span> <span class=\"hljs-selector-tag\">C<\/span>:\\<span class=\"hljs-selector-tag\">python<\/span>\\<span class=\"hljs-selector-tag\">Lib<\/span>\\<span class=\"hljs-selector-tag\">site-packages<\/span>\\<span class=\"hljs-selector-tag\">pip<\/span> (<span class=\"hljs-selector-tag\">python<\/span> 3<span class=\"hljs-selector-class\">.13<\/span>)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id='install-pipenv-on-windows'>Install pipenv on Windows <a href=\"#install-pipenv-on-windows\" class=\"anchor\" id=\"install-pipenv-on-windows\" title=\"Anchor for Install pipenv on Windows\">#<\/a><\/h2>\n\n\n\n<p>First, use the following command to install <code>pipenv<\/code> tool:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">pip install pipenv<\/code><\/span><\/pre>\n\n\n<p>Second, type the following command to check if the <code>pipenv<\/code> installed correctly:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">pipenv -h<\/code><\/span><\/pre>\n\n\n<p>If it shows the following output, then you&#8217;ve successfully installed the <code>pipenv<\/code> tool successfully.<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-tag\">Usage<\/span>: <span class=\"hljs-selector-tag\">pipenv<\/span> <span class=\"hljs-selector-attr\">&#91;OPTIONS]<\/span> <span class=\"hljs-selector-tag\">COMMAND<\/span> <span class=\"hljs-selector-attr\">&#91;ARGS]<\/span>...\n...<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id='creating-a-new-project'>Creating a new project <a href=\"#creating-a-new-project\" class=\"anchor\" id=\"creating-a-new-project\" title=\"Anchor for Creating a new project\">#<\/a><\/h2>\n\n\n\n<p>First, create a new project folder e.g., <code>crawler<\/code>:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">mkdir crawler\ncd crawler<\/code><\/span><\/pre>\n\n\n<p>Second, navigate to the <code>crawler<\/code> folder and install the <code>requests<\/code> package using the <code>pipenv<\/code> command:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">pipenv install requests<\/code><\/span><\/pre>\n\n\n<p>You&#8217;ll see that <code>pipenv<\/code> created two new files called <code>Pipfile<\/code> and <code>Pipfile.lock<\/code>. On top of that, it installed a virtual environment.<\/p>\n\n\n\n<p>If you look at the project folder, you won&#8217;t see the virtual environment folder. <\/p>\n\n\n\n<p>To find the location of the virtual environment, you use the following command:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">pipenv --venv<\/code><\/span><\/pre>\n\n\n<p>It&#8217;ll return something like this on Windows:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"HTML, XML\" data-shcb-language-slug=\"xml\"><span><code class=\"hljs language-xml\">C:\\Users\\<span class=\"hljs-tag\">&lt;<span class=\"hljs-name\">username<\/span>&gt;<\/span>\\.virtualenvs\\crawler-3xu8GCrV<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">HTML, XML<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">xml<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Note that the <code>&lt;username&gt;<\/code> is the username that you use to log in to Windows.<\/p>\n\n\n\n<p>Third, activate the new virtual environment using the following command:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">pipenv shell<\/code><\/span><\/pre>\n\n\n<p>The prompt will change to something like:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">(crawler-3xu8GCrV) D:\\python_projects\\crawler&gt;<\/code><\/span><\/pre>\n\n\n<p>Third, create a new file called <code>app.py<\/code> in the project folder and add the following code to the file:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-5\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">import<\/span> requests\n\nresponse = requests.get(<span class=\"hljs-string\">'https:\/\/www.python.org\/'<\/span>)\nprint(response.status_code)<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-5\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>In this code, we imported the <code>requests<\/code> third-party module, use the <code>get()<\/code> function to make an HTTP request to the URL <code>https:\/\/www.python.org\/<\/code> and display the status code (<code>200<\/code>).<\/p>\n\n\n\n<p>Fourth, run the <code>app.py<\/code> file from the terminal by using the python command:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-6\" data-shcb-language-name=\"CSS\" data-shcb-language-slug=\"css\"><span><code class=\"hljs language-css\"><span class=\"hljs-selector-tag\">python<\/span> <span class=\"hljs-selector-tag\">app<\/span><span class=\"hljs-selector-class\">.py<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-6\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">CSS<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">css<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>It&#8217;ll show the following the returned HTTP status code:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">200<\/code><\/span><\/pre>\n\n\n<p>The status code 200 means the HTTP request has succeeded.<\/p>\n\n\n\n<p>Fifth, close the virtual environment using the <code>exit<\/code> command:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-7\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\"><span class=\"hljs-keyword\">exit<\/span><\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-7\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<h2 class=\"wp-block-heading\" id='quiz'>Quiz <a href=\"#quiz\" class=\"anchor\" id=\"quiz\" title=\"Anchor for Quiz\">#<\/a><\/h2>\n\n\n\n<iframe loading=\"lazy\"\n  name=\"quiz\"\n  src=\"\/quiz\/?quiz=pipenv\"\n  height=\"700\"\n  width=\"600\"\n  class=\"iframe\"\n><\/iframe>\n\n<div class=\"helpful-block-content\" data-title=\"\">\n\t<header>\n\t\t<div class=\"wth-question\">Was this tutorial helpful ?<\/div>\n\t\t<div class=\"wth-thumbs\">\n\t\t\t<button\n\t\t\t\tdata-post=\"670\"\n\t\t\t\tdata-post-url=\"https:\/\/www.pythontutorial.net\/python-basics\/install-pipenv-windows\/\"\n\t\t\t\tdata-post-title=\"How to Install pipenv on Windows\"\n\t\t\t\tdata-response=\"1\"\n\t\t\t\tclass=\"wth-btn-rounded wth-yes-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t\tclass=\"feather feather-thumbs-up block w-full h-full\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M14 9V5a3 3 0 0 0-3-3l-4 9v11h11.28a2 2 0 0 0 2-1.7l1.38-9a2 2 0 0 0-2-2.3zM7 22H4a2 2 0 0 1-2-2v-7a2 2 0 0 1 2-2h3\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> Yes <\/span>\n\t\t\t<\/button>\n\n\t\t\t<button\n\t\t\t\tdata-response=\"0\"\n\t\t\t\tdata-post=\"670\"\n\t\t\t\tdata-post-url=\"https:\/\/www.pythontutorial.net\/python-basics\/install-pipenv-windows\/\"\n\t\t\t\tdata-post-title=\"How to Install pipenv on Windows\"\n\t\t\t\tclass=\"wth-btn-rounded wth-no-btn\"\n\t\t\t>\n\t\t\t\t<svg\n\t\t\t\t\txmlns=\"http:\/\/www.w3.org\/2000\/svg\"\n\t\t\t\t\tviewBox=\"0 0 24 24\"\n\t\t\t\t\tfill=\"none\"\n\t\t\t\t\tstroke=\"currentColor\"\n\t\t\t\t\tstroke-width=\"2\"\n\t\t\t\t\tstroke-linecap=\"round\"\n\t\t\t\t\tstroke-linejoin=\"round\"\n\t\t\t\t>\n\t\t\t\t\t<path\n\t\t\t\t\t\td=\"M10 15v4a3 3 0 0 0 3 3l4-9V2H5.72a2 2 0 0 0-2 1.7l-1.38 9a2 2 0 0 0 2 2.3zm7-13h2.67A2.31 2.31 0 0 1 22 4v7a2.31 2.31 0 0 1-2.33 2H17\"\n\t\t\t\t\t><\/path>\n\t\t\t\t<\/svg>\n\t\t\t\t<span class=\"sr-only\"> No <\/span>\n\t\t\t<\/button>\n\t\t<\/div>\n\t<\/header>\n\n\t<div class=\"wth-form hidden\">\n\t\t<div class=\"wth-form-wrapper\">\n\t\t\t<div class=\"wth-title\"><\/div>\n\t\t\t<textarea class=\"wth-message\"><\/textarea>\n\t\t\t<input type=\"button\" name=\"wth-submit\" class=\"wth-btn wth-btn-submit\" id=\"wth-submit\" \/>\n\t\t\t<input type=\"button\" class=\"wth-btn wth-btn-cancel\" value=\"Cancel\" \/>\n\t\t<\/div>\n\t<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>In this tutorial, you&#8217;ll learn how to install the pipenv packaging tool on Windows.<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":37,"menu_order":80,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-670","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/670","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/comments?post=670"}],"version-history":[{"count":4,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/670\/revisions"}],"predecessor-version":[{"id":7209,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/670\/revisions\/7209"}],"up":[{"embeddable":true,"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/pages\/37"}],"wp:attachment":[{"href":"https:\/\/www.pythontutorial.net\/wp-json\/wp\/v2\/media?parent=670"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}