{"id":34289,"date":"2020-03-31T20:59:40","date_gmt":"2020-03-31T15:29:40","guid":{"rendered":"https:\/\/www.wikitechy.com\/technology\/?p=34289"},"modified":"2020-03-31T20:59:40","modified_gmt":"2020-03-31T15:29:40","slug":"how-to-edit-pythonpath-on-windows","status":"publish","type":"post","link":"https:\/\/www.wikitechy.com\/technology\/how-to-edit-pythonpath-on-windows\/","title":{"rendered":"How to edit PYTHONPATH on Windows"},"content":{"rendered":"<p>You are here because you\u2019re using:<\/p>\n<ul>\n<li>Windows OS version 10+<\/li>\n<li>Python version 3.3+<\/li>\n<li>Anaconda3<\/li>\n<\/ul>\n<p>And you\u2019d wish to edit your<strong> PYTHONPATH<\/strong> permanently.<\/p>\n<h3 id=\"tldr\">TL;DR<\/h3>\n<ul>\n<li>Go to <strong>C:\\Users\\\\your_username\\Lib\\site-packages<\/strong><\/li>\n<li>Create a file<strong> python37.pth<\/strong><\/li>\n<li>Edit the file to incorporate this line <strong><code>C:\\\\Users\\\\<your_username>\\\\my_<\/code>module<\/strong><\/li>\n<\/ul>\n<p>The Long version; Do Read<\/p>\n<p><strong>Prologue<\/strong><\/p>\n<p>In most cases, editing the <strong>PYTHONPATH<\/strong> from the Settings GUI will do the trick. The trick is well explained during this Stack Overflow answer.<br \/>\nIf within the first place you\u2019re only looking to edit your path locally, this useful answer will do.<\/p>\n<h3 id=\"slightly-extended-item-no-1\">Slightly Extended Item no. 1<\/h3>\n<p>If you don\u2019t have <strong>C:\\Users\\\\Anaconda3\\Lib\\site-packages<\/strong>, replace <strong>C:\\Users\\<\/strong> with the trail to your Anaconda3.<\/p>\n<h3 id=\"slightly-extended-item-no-2\">Slightly Extended Item no. 2<\/h3>\n<p>If you\u2019re using Python3.7, create a file called <strong>python37.pth<\/strong>. Else create a file called <strong>python.pth<\/strong>\u00a0 <strong><code>hon<XX&g<\/code>t<\/strong>;.pth for whatever Python version you are using.<\/p>\n<p>Not sure which version?<\/p>\n<ul>\n<li>Under\u00a0<strong><code>C:\\Users\\<your_username>\\wikitechy<\/code>\\<\/strong> search for a file of the<code>\u00a0form <strong>python&l<\/strong><\/code><strong>t;XX&g<\/strong><code><strong>t<\/strong>;<strong>.d<\/strong><\/code><strong>ll.<\/strong> The <<strong>XX<\/strong>> indicates the version number you nee<code>d fo<\/code>r naming your .pth file.<\/li>\n<li>Windows is super annoying and won\u2019t allow you to create a file with a .pth suffix?<br \/>\nThere are such files within the<strong> C:\\Users\\wikitechy\\Lib\\site-packages<\/strong> folder. Copy one among them and edit the prefix.<\/li>\n<li>Some places say you would like to make a<strong> ._pth<\/strong> file rather than <strong>.pth<\/strong>?<br \/>\nA <strong>._pth<\/strong> file will completely replace your existing path. While a <strong>.pth<\/strong> file will append its content to the trail you have already got . you\u2019ll find more information here.<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>You are here because you\u2019re using: Windows OS version 10+ Python version 3.3+ Anaconda3 And you\u2019d wish to edit your PYTHONPATH permanently. TL;DR Go to C:\\Users\\\\your_username\\Lib\\site-packages Create a file python37.pth Edit the file to incorporate this line C:\\\\Users\\\\\\\\my_module The Long version; Do Read Prologue In most cases, editing the PYTHONPATH from the Settings GUI will [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":34300,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4148],"tags":[86761,87091],"class_list":["post-34289","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-python","tag-python","tag-pythonpath-on-windows"],"_links":{"self":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/posts\/34289","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=34289"}],"version-history":[{"count":0,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/posts\/34289\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/media\/34300"}],"wp:attachment":[{"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/media?parent=34289"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/categories?post=34289"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wikitechy.com\/technology\/wp-json\/wp\/v2\/tags?post=34289"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}