{"id":34276,"date":"2020-03-31T20:57:16","date_gmt":"2020-03-31T15:27:16","guid":{"rendered":"https:\/\/www.wikitechy.com\/technology\/?p=34276"},"modified":"2020-03-31T20:57:16","modified_gmt":"2020-03-31T15:27:16","slug":"installing-multiple-python-versions-on-windows-using-virtualenv","status":"publish","type":"post","link":"https:\/\/www.wikitechy.com\/technology\/installing-multiple-python-versions-on-windows-using-virtualenv\/","title":{"rendered":"Installing Multiple Python Versions on Windows Using Virtualenv"},"content":{"rendered":"<p><strong>You are here because:<\/strong><\/p>\n<ul>\n<li>You are using Windows OS version 10+<\/li>\n<li>You would wish to use multiple Python versions on an equivalent computer<\/li>\n<li>You are uninterested in the web telling you to \u201c<span style=\"color: #ff0000;\">Just Use Virtualenv<\/span>\u201d<\/li>\n<\/ul>\n<h3 id=\"tldr\">TL;DR<\/h3>\n<ol>\n<li>Open <strong>prompt<\/strong> and enter <strong>pip install virtualenv<\/strong><\/li>\n<li>Download the specified <strong>python<\/strong> version (do NOT increase PATH!), and remember the <span style=\"color: #ff0000;\">path\\to\\new_python.exe<\/span> of the newly installed version<\/li>\n<li>To create a virtualenv, open prompt and enter<br \/>\n<span style=\"color: #ff0000;\">virtualenv \\path\\to\\env -p path\\to\\new_python.exe<\/span><\/li>\n<li>If you&#8217;re using <strong>PyCharm<\/strong>, update the<span style=\"color: #ff0000;\"> Project Interpreter<\/span> and therefore the <span style=\"color: #ff0000;\">Code compatibility inspection.<\/span><\/li>\n<li>To install packages:<br \/>\n(I) Activate virtualenv: open prompt and enter<span style=\"color: #ff0000;\"> path\\to\\env\\Scripts\\activate.bat<\/span><br \/>\n(II) Install desired packages<br \/>\n(III) Deactivate with <span style=\"color: #ff0000;\">deactivate<\/span> .<\/li>\n<\/ol>\n<p>The Long version; Do Read<\/p>\n<h3 id=\"prologue\">Prologue<\/h3>\n<p>If you&#8217;re using the Anaconda App this process could be easier using their GUI. I haven\u2019t tried it myself, please let me skills it went if you&#8217;re taking place that road \ud83d\ude42<\/p>\n<p><strong>1. Install virtualenv<\/strong><\/p>\n<p>If you have already got some virtual environments, or are using Anaconda, confirm subsequent steps are performed from outside of these environments.<\/p>\n<p><strong>2. Install Python<\/strong><\/p>\n<p>You can download python from the official site, for instance for<strong> python3.7.3<\/strong> go here.<\/p>\n<p>The file you ought to be downloading is named <strong>Windows x86\u201364 executable installer<\/strong>, or <strong>Windows x86 executable installer<\/strong> if for a few reason you&#8217;re employing a <span style=\"color: #ff0000;\">32-bit<\/span> windows.<\/p>\n<p>Once downloading is finished, open the executable file and an installation prompt will appear.<\/p>\n<ul>\n<li>You do NOT want to feature the new python to your PATH since we are getting to have multiple python versions on an equivalent computer, and that we would really like for every application to understand just one python version.<\/li>\n<li>Either use the default suggested location for the new python, or supply a location of your choice. Either way, remember this location and let\u2019s denote it from now on with <strong><code>C:\\&lt;some_path&gt;\\Python37<\/code>\u00a0.<\/strong><\/li>\n<\/ul>\n<p><img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter size-full wp-image-34277\" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2020\/03\/1_6TY68J0S0Mls0m3fthyaCg.png\" alt=\"\" width=\"1000\" height=\"610\" srcset=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2020\/03\/1_6TY68J0S0Mls0m3fthyaCg.png 1000w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2020\/03\/1_6TY68J0S0Mls0m3fthyaCg-300x183.png 300w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2020\/03\/1_6TY68J0S0Mls0m3fthyaCg-768x468.png 768w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2020\/03\/1_6TY68J0S0Mls0m3fthyaCg-990x604.png 990w\" sizes=\"(max-width: 1000px) 100vw, 1000px\" \/><\/p>\n<h3 id=\"3-create-a-virtualenv\">3. Create a virtualenv<\/h3>\n<p>Open the prompt , or if you&#8217;re using Anaconda open the <strong>Anaconda Prompt<\/strong> .<\/p>\n<p>Decide where you would like your virtualenv to be, for instance ,<br \/>\n<strong>C:\\Users\\\\Anaconda3\\envs\\ .<\/strong><\/p>\n<p>Enter:<\/p>\n<p><strong>virtualenv C:\\Users\\\\Anaconda3\\envs\\ -p C:\\\\Python37\\python.exe<\/strong><\/p>\n<p><strong>4. Update PyCharm Interpreter<\/strong><\/p>\n<p>If you&#8217;re using PyCharm, open the project you&#8217;d wish to work on (that is\/will be written with the new python version), and attend<span style=\"color: #ff0000;\"> File -&gt; Settings -&gt; Project -&gt; Project Interpreter<\/span> press the gear icon then Add.. .<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-34278\" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2020\/03\/image-43.png\" alt=\"\" width=\"794\" height=\"340\" srcset=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2020\/03\/image-43.png 794w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2020\/03\/image-43-300x128.png 300w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2020\/03\/image-43-768x329.png 768w\" sizes=\"(max-width: 794px) 100vw, 794px\" \/><\/p>\n<p>This will open a prompt window that allows you to define a new interpreter:<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-34279\" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2020\/03\/1_EyUVRuDrL1NtI-6kyAylpw.png\" alt=\"\" width=\"1000\" height=\"343\" srcset=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2020\/03\/1_EyUVRuDrL1NtI-6kyAylpw.png 1000w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2020\/03\/1_EyUVRuDrL1NtI-6kyAylpw-300x103.png 300w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2020\/03\/1_EyUVRuDrL1NtI-6kyAylpw-768x263.png 768w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2020\/03\/1_EyUVRuDrL1NtI-6kyAylpw-990x340.png 990w\" sizes=\"(max-width: 1000px) 100vw, 1000px\" \/><\/p>\n<p>Assuming you&#8217;re using Code Inspections, you would possibly got to tell PyCharm which python version to examine for. attend <span style=\"color: #ff0000;\">File -&gt; Settings-&gt; Editor -&gt; Inspections -&gt; Python -&gt; Code<\/span> <span style=\"color: #ff0000;\">compatibility Inspection<\/span> , confirm the box on the highest indicates the precise project you&#8217;re performing on , and tick the box of your python version.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-34282\" src=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2020\/03\/1_vHL71y1uLNsUGPOEOrFmkQ.png\" alt=\"\" width=\"985\" height=\"696\" srcset=\"https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2020\/03\/1_vHL71y1uLNsUGPOEOrFmkQ.png 985w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2020\/03\/1_vHL71y1uLNsUGPOEOrFmkQ-300x212.png 300w, https:\/\/www.wikitechy.com\/technology\/wp-content\/uploads\/2020\/03\/1_vHL71y1uLNsUGPOEOrFmkQ-768x543.png 768w\" sizes=\"(max-width: 985px) 100vw, 985px\" \/><\/p>\n<p>If you don\u2019t see your python version on the Options list, this might also be the time to update PyCharm\u2026 yup, happened to me\u00a0too\u2026<\/p>\n<h3 id=\"5-install-packages\">5. Install packages<\/h3>\n<p>Currently, your <strong>virtualenv<\/strong> contains only the crucial packages,<strong> pip<\/strong> and <strong>setuptools<\/strong> . to put in more packages:<\/p>\n<ul>\n<li>Open prompt or Anaconda Prompt , and activate your virtualenv by entering<br \/>\n<strong>C:\\Users\\\\Anaconda3\\envs\\\\activate.bat<\/strong><\/li>\n<li>Use <strong>pip<\/strong> to put in packages such as you usually do.<\/li>\n<li>Deactivate your virtualenv by entering <strong>deactivate<\/strong> .<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You are here because: You are using Windows OS version 10+ You would wish to use multiple Python versions on an equivalent computer You are uninterested in the web telling you to \u201cJust Use Virtualenv\u201d TL;DR Open prompt and enter pip install virtualenv Download the specified python version (do NOT increase PATH!), and remember the [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":34285,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4148],"tags":[87090,86761],"class_list":["post-34276","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","tag-installing-multiple-python","tag-python"],"_links":{"self":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/posts\/34276","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/comments?post=34276"}],"version-history":[{"count":0,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/posts\/34276\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/media\/34285"}],"wp:attachment":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/media?parent=34276"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/categories?post=34276"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/tags?post=34276"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}