🌐
Reddit
reddit.com › r/codinghelp › what does it mean to " add python to path " ?
r/CodingHelp on Reddit: what does it mean to " Add python<version> to PATH " ?
December 29, 2021 -

pretty much the title

asking bc i am installing python and i wanna know what will happen if i don't really click on the checkbox

Python 3.8 install path issues Sep 29, 2020
r/learnpython
6y ago
Add python to PATH variable in Git Bash? Nov 30, 2022
r/linuxquestions
3y ago
Add a directory to PATH(Mac user, Python newbie) Jan 3, 2019
r/learnpython
7y ago
What does PYTHONPATH=. do? Jan 20, 2017
r/learnpython
9y ago
More results from reddit.com
🌐
Reddit
reddit.com › r/pythontips › what if you forget to add python to path?
r/pythontips on Reddit: What if you forget to add Python to PATH?
August 20, 2021 -

If you forget to add Python to the PATH, you won't be able to run Python in your command line from any other directory.

You will get a message saying,

'python' is not recognized as an internal or external command.

This is because Windows is trying to search for Python in its PATH variable and is unable to find it.

Here is a step-by-step instruction to add Python to the PATH variable in Windows 10.

  1. Copy the directory to which Python is being installed.

  2. Search for System Properties in the Search Bar.

  3. Click on the "Environment Variables" button in System Properties.

  4. Click on the "Path" variable and then click on "Edit".

  5. Now here's the deal. Pay Attention! Paste the directory path from Step 1 at the top of the list. You can use the "Move up" button to get it to the top. Now click on "Ok".

Now you can open up your command line and run python. The Python interactive shell will open up.

*Here is a little extra tip! *

Add the Scripts folder to the PATH variable too. This is the folder where all your libraries will be installed.

If the instructions are not clear enough for you, you can also check out the visual guide containing images of every step, on my blog for achieving the above objective.

Good luck and let me know!

🌐
Reddit
reddit.com › r/python › why doesnt python add itself to path on windows?
r/Python on Reddit: Why doesnt Python add itself to PATH on Windows?
August 21, 2023 - So you should avoid python and use py instead. We can argue about whether the python launcher was a good idea or not, but given that it exists, it makes sense not to add python to your PATH.
🌐
Reddit
reddit.com › r/learnpython › adding .py to path?
r/learnpython on Reddit: Adding .py to PATH?
August 29, 2021 -

So I have been using a python script that I found called sherlock, and I love it. I ended up writing a new script that utilizes the Sherlock script to make using it in cmd easier. And recently i have been starting to learn about environment variables, specifically the PATH environment variable. Is there any way that I can add a .py file to the PATH variable so that I can just type "sherlock <usrname>" and have it work? Instead of having to cd to the directory and typing "python3 sherlock.py <usrname>"?

🌐
Reddit
reddit.com › r/python › windows installer should add `python` to the path variable?
r/Python on Reddit: Windows installer should add `python` to the PATH variable?
November 25, 2017 - There is an option! WOW... Should be ticked by default then? ... I don't think so. ... The latest python puts "py.exe" in C:\Windows, which is already in the path. Associate your files with that or use py filename.py to launch stuff.
🌐
Reddit
reddit.com › r/learnpython › is it a good idea to add the python scripts to the path?
r/learnpython on Reddit: Is it a good idea to add the Python Scripts to the PATH?
October 12, 2023 -

yeah, pretty much that.This is because i was having problems to use Scrapy (the term scrapy wasnt recognized in the terminal), and long story short i figured out that the python Scripts folder, which im guessing thats where the pip packages get installed, is not in PATH.

I guess is obvious but i've installed several libraries using pip and ,as you can notice, i dont have much experience in this kind of problems, so i dont have any idea of what things i could mess up by adding the directory to the PATH.

Top answer
1 of 4
16
Back in the old days, there used to be one computer in a house with multiple users, nowadays pretty much everyone has its own PC, but you can still have multiple users. First options installs Python for all users, even tho it will probably be just you. PATH is something like a variable in your OS that says where to look for programs, if you open up command prompt and type "program.exe", cmd will go over all entried in PATH and look if it finds "program.exe" in any of those. You probably want to check that one too, doesnt really hurt anything and if you end up running python from terminalm it will be useful for the shell to find Python via PATH.
2 of 4
4
When you type in a command or anything, even just gibberish into a command window, the first thing the command interrupter does is looks to see if it is a built in command, that is a command that the cmd.exe deals with on it's own. Like cd or dir are built in commands. If the command interrupter decides it is not a built in command, it looks in the current directory you are in for whatever you typed, and if it finds it and it is executable, runs it, if it can not find it in the current directory, it looks at an environment variable called the path. This is a list of directories that the command interrupter will look in, in the order they are listed, and it will run the first instance of the executable it finds. If it can not find an executable, it returns an error message. For example if I do: C:\Users\sdr\Downloads>foobar and I have not foobar that is executable in the current director or in my path, it returns an error telling me. Note I may have a foobar that is executable on the system but it is not in my path. 'foobar' is not recognized as an internal or external command, operable program or batch file. If you have a program that will allow you to install different versions, this can get tricky, like if you install two versions of python and add them both to your path, you need to look at your path to see which one it will find and run, it runs the first one it finds. You can also see where a program in your path lives with the where command: C:\Users\sdr\Downloads>where python C:\Users\sdr\AppData\Local\Programs\Python\Python310\python.exe So if I type python, I will run C:\Users\sdr\AppData\Local\Programs\Python\Python310\python.exe even if I have another version installed, and V310 is the first one in my path. If I had another one I probably should remove it from my path as it will not ever run by just typing it and it just makes the path longer and more complicated. Linux is very similar but a bit different, different delimiter between path components and by default it does NOT look in the current directory, that is why you see ./command a lot in linux and you never see .\command in windows. the . means the current directory, do ./command means that command in the current directory. BTW, I would strongly recommend anaconda over python. But YMMV.
🌐
Reddit
reddit.com › r/python › how should i treat my python installation?
r/Python on Reddit: How should I treat my python installation?
November 11, 2022 -

This is like the third time I've formatted my computer this month, and I just now remembered my Python installation being all messed up was one of the reasons I decided to do that!

What is the best way to go about managing python packages/environments? Conda, miniconda, poetry, pip? Specifically, what should I use and how should I use it to keep my environments and installation clean?

Top answer
1 of 25
26
Pyenv for Python (and all the versions of python you need), venv/poetry for everything else. Only touch your Python installation to create local virtual environments.
2 of 25
19
I like the whole KISS method, so I just use the default Python builtin 'venv'.. https://docs.python.org/3/library/venv.html python -m venv /path/to/new/virtual/environment ..from you project level directory. Each project then has their own requirements installed in the venv folder without messing any other project or your system Python up. When you are working on that project just activate the venv and use pip install to put any packages into that folder. Most IDEs will have an option to auto enable that venv when you select the directory, or at least make it an easy 2/3 click process. Below is just a sample setup: python -m venv .venv > Project Directory > Project 1 > .venv > tests | .gitignore | init_db.py | main.py | requirements.txt > Project 2 > .venv > resources > static > templates > tests | .gitignore | app.py | init_db.py | main.py | requirements.txt > Project 3 > .venv > static > templates > tests | .gitignore | app.py | init_db.py | requirements.txt Add the .venv to your .gitignore Use pip freeze > requirements.txt to export a list of dependencies that can be uploaded so people can use the same file version you created the program with. To restore your venv folder or set it up on a different computer; clone the project from your git supplier, create the venv directory again, run pip install -r requirements.txt to download and install the dependencies you had on the original system.
Find elsewhere
🌐
Reddit
reddit.com › r/learnpython › how do i install python "correctly?"
r/learnpython on Reddit: How do I Install Python "Correctly?"
November 4, 2020 -

I'm working my way through Automate the Boring Stuff and I'm to the part where I have to consult Appendices A and B in order to install new modules and run Python scripts outside of Mu.

I thought I'd installed Python correctly until I reached this point. I'm getting extremely confused by how I'm "supposed" to install python, configure PATH variables, install modules, etc.

For example, I have "python.exe" located in:

C:\Users\myname\AppData\Local\Programs\Python\Python39

But I also have "py.exe" located in:

C:\Windows

From what I understand, I have to run commands starting with "python" from the former location and "py" from the latter location. Am I supposed to have two different locations like this or is this redundant? Did I mess up the installation?

I managed to get the mclip.py project working, however now I'm working on the Zombie Dice project and I'm having issues with installing the module all of a sudden.

For example, I opened the cmd prompt, changed my directory to

C:\Users\myname\AppData\Local\Programs\Python\Python39\Scripts

and used PIP to install the module. However, when I open Mu and run:

import zombiedice
zombiedice.demo()

...I receive an error message:

Traceback (most recent call last):
    File "c:\users\myname\mu_code\test.py", line 2, in <module>
        import zombiedice
ModuleNotFoundError: No module named 'zombiedice'

Why isn't Mu recognizing the zombiedice module after I "successfully" installed it earlier?

Also, when I was installing the module, I received a warning that a newer version of PIP was available so I upgraded PIP. After upgrading, it gave me a warning:

WARNING: The scripts pip.exe, pip3.9.exe and pip3.exe are installed in 'C:\Users\myname\AppData\Local\Programs\Python\Python39\Scripts' which is not on PATH.

Consider adding this directory to PATH

I don't know why it's giving me this warning when I already have this directory on PATH. When I run "echo %PATH%", the directory appears among the list of directories.

This is all extremely confusing and frustrating, constantly having to spend hours going through files, directories, and commands just to get scripts working.

Are Python files, scripts, projects, directories, modules, etc. all supposed to be scattered all across my computer like this? Can't I just have one neat little folder called "Python" somewhere which contains everything? Or do I really have to keep track of where all of these different things are?

🌐
Reddit
reddit.com › r/learnpython › set up python for windows 10
r/learnpython on Reddit: Set up Python for Windows 10
September 11, 2016 -

Hi, I just began working with Python in University and now I wanna set up Python on my home PC which is running Windows 10. I would like to use "Atom" as text editor. The problem is that I cann't run Python scripts. I am getting an error:

Unable to find command: python Are you sure PATH is configured correctly?

I actually don't really know how to configure PATH. I created a new System variable, but I am not sure if it has to have a specific name and which value it's need to have.

I downloaded Python 3.5.2 from the official site: Python

So, does anyone know how to set up Python on Windows 10 correctly?

🌐
Reddit
reddit.com › r › learnprogramming › comments › 7ns052 › how_do_i_set_python_into_my_path
r/learnprogramming - How do I set python into my PATH?
January 3, 2018 -

I have been using this website https://docs.python.org/2/using/windows.html for a while but I am confused on how to set python onto my PATH. I went into "edit environmental settings" but then im not sure what it wants me to do next or if it even contributes to setting it onto my path.

Can anybody explain in detail how to do this?

🌐
Reddit
reddit.com › r/ece › i am a little confused about adding to “path”which i keep on hearing in python or matlab programming. what exactly is adding something to path mean?
r/ECE on Reddit: I am a little confused about adding to “path”which I keep on hearing in python or matlab programming. What exactly is adding something to path mean?
June 6, 2022 - To facilitate this, you add to the $PATH variable to let the system know where to look, such that it knows what you mean when you type "java --...." or "python ..." On windows, press the windows key and type env, and select edit the system ...
🌐
Reddit
reddit.com › r/learnpython › please help me set my python path environment variable.
r/learnpython on Reddit: Please help me set my Python PATH environment variable.
November 22, 2017 -

Hello, I'm using Python 3.6 with windows 8.1, and I edited the Path variable under: edit the system environment variables. I added my python.exe directory which is C:\Users\Tom\AppData\Local\Programs\Python\Python36 of course with a semi colon before. If I understood this correctly, I can run python scripts just by opening a regular command prompt window with python.exe

When I run command prompt and enter python.exe it says it is unrecognized. However when I go to my python directory, shift+right click and open a command window there, and enter: python.exe somescript.py (command line args) it works fine. What gives?

🌐
Reddit
reddit.com › r/linux4noobs › issues when adding python to path
r/linux4noobs on Reddit: issues when adding Python to PATH
March 18, 2024 -

Hi all, I'm trying to install some python libraries that I need on my computer (running Kubuntu 22.04.4) and I added to PATH the following:

export PATH="$PATH:/usr/local/bin/python"

in order to be able to use these packages and I got no problems with it.

When I installed jupyter-lab I got a warning message telling me to add /home/[user]/.local/bin to the PATH but when I add it to my ~/.zshrc file I lose the ability to use any other command (like sudo, apt-get, mkdir and so on)

I really need to use jupyter so if anyone has some ideas please help me

Thank you in advance!

🌐
Reddit
reddit.com › r/python › python and the path variable in windows 10
r/Python on Reddit: Python and the PATH variable in Windows 10
August 20, 2021 -

Do you remember checking the box in the image shown below to add your Python installation to PATH in Windows 10?

Adding Python to PATH

Well, I was curious! What if someone accidentally forgot to check that little radio button? What would be the possible recovery steps?

So I spent my evening yesterday uninstalling Python and re-installing to figure out a way to add Python to the PATH post-installation.

If you forget to add Python to the PATH variable, you won't be able to run Python in your command line.

You will get a message saying,

‘python' is not recognized as an internal or external command.

Here are the steps I used to add Python to the PATH variable in Windows 10.

  1. Copy the directory to which Python is being installed.

  2. Search for System Properties in the Search Bar.

  3. Click on the "Environment Variables" button in System Properties.

  4. Click on the "Path" variable and then click on "Edit".

  5. Now here's the deal. Paste the directory path from Step 1 at the top of the list. You can use the "Move up" button to get it to the top. Now click on "Ok".

I found out that if you paste the path at the end, it still doesn't work. Can someone tell me why?

Anyways, if the steps are not clear to anyone, here is a visual guide containing images of every step, on my blog for achieving the above objective. If you are interested, do take a look.

🌐
Reddit
reddit.com › r/learnpython › is configuring a machine to run python that complicated? installation directory, path variables, interpreter vs terminal, importing libs, etc
r/learnpython on Reddit: Is configuring a machine to run python that complicated? Installation directory, PATH variables, interpreter vs terminal, importing libs, etc
December 19, 2023 -

Howdy!

Context: I have a very powerful notebook with Windows, and I write and execute code locally. Things happened, and I'm having to setup a new environment to mirror my own so that other people can also write and execute the same code.

But damn, how hard is it? The company repository only has Python 32bit available, so I had to get a ticket to get the 64bit version installed. But the directory is different (32bit on program files, 64bit on appdata). Then VScode is running on the 64bit interpreter, but VSCode terminal is stuck on the 32bit version. The 64bit apparently is not on the PATH, and it throws an error if I try to import Pandas with the 64bit interpreter because I "should not try to import numpy from its source directory". I tried adding the 64bit appdata directory to PATH, but it doesn't save and it reverts back afterwards.

I'm used to just installing Anaconda which appears to take care of a lot of things, but it shouldn't be this hard to get things to work.

Was my installation done wrong? Or am i missing something in the configuration?

Cheers!

Top answer
1 of 5
2
Open your project folder in VSCode, bring up a terminal, use "py venv venv" to create a "virtual environment" (which is really just a Python installation that is local to your project) and then run ".\venv\Scripts\Activate.ps1" to activate it. Once you see the green venv name to the left of your terminal prompt, use pip to install the libraries you need inside of your project itself. VSCode *should* pick that up automatically, but if it does not, change your project environment to point to that new "venv" folder. Click the 'environment' option in the lower, right of your bottom toolbar to easily access that setting.
2 of 5
2
But damn, how hard is it? The company repository only has Python 32bit available, so I had to get a ticket to get the 64bit version installed. I can relate, some places I've worked at were quite strict about these things too. For example one was stuck on Python 3.6 and I doubt they've managed to upgrade yet. But the directory is different (32bit on program files, 64bit on appdata). Shouldn't really matter. Then VScode is running on the 64bit interpreter, but VSCode terminal is stuck on the 32bit version. I take this to mean that VS Code is configured to use the 64-bit installation, but PowerShell defaults to the 32-bit one. That about right? The 64bit apparently is not on the PATH, and it throws an error if I try to import Pandas with the 64bit interpreter because I "should not try to import numpy from its source directory". Are the two installations using the same version of Python? If not, and the 64-bit installation is newer, you should be able to access it via the Python Launcher (py) just fine even without it being on PATH. If they use the same version, you should still be able to do this but you may need to specify the version and add a -64 postfix. For example, if I had both 32- and 64-bit versions of 3.10 installed, I could specify the latter using py -3.10-64. That will act like the python command for a particular installed version, meaning you can then access it for purposes such as installing a package py -3.10-64 -m pip install escapyde or, as explained by the others, creating (and activating) a virtual environment: py -3.10-64 -m venv project_name_venv ./project_name_venv/Scripts/Activate.ps1 I'm sure it'll take some getting used to, but it's not as difficult as it may seem.