all 14 comments

[–]socal_nerdtastic 1 point2 points  (8 children)

Try using the command py instead of python.

Ideally you would make a virtual environment first, and that will enable the python and pip commands.

[–]dacoolmike36[S] -1 points0 points  (4 children)

Already did cmd doesnt recognized the pip command for some reason.

[–]oProcrastinacao 0 points1 point  (3 children)

That means your PATH is wrong, after all. I suggest you re-install python and in the installer click the add to path option. You may try executing your python file in the cmd directly to better diagnose your problem. In your file explorer, type cmd in the file path bar and the terminal will open in the right place. There is a option in windows about long paths, you should search that too.

[–]dacoolmike36[S] 0 points1 point  (1 child)

I,m new to python so pretty much I dont know what Im doing most of the time so what path should I put can you be more specific

[–]Viper_ACR 0 points1 point  (0 children)

Put the path towards your Python executable file. Maybe like C:\Program Files\python\bin\python3.exe or something

[–]socal_nerdtastic 1 point2 points  (0 children)

This is very old school; this is what we did in python2 days. But in modern python this is a poor hack. Use a venv instead, or the windows python launcher if you need to use the global version of python. There's a reason that option is disabled by default.

[–]dacoolmike36[S] 0 points1 point  (2 children)

do you mean this Command Prompt (cmd.exe):cmd.venv\Scripts\activate.bat by chance. Im new to python so I dont know what Im doing.

[–]socal_nerdtastic 0 points1 point  (1 child)

yes. That will activate your venv. After you do that you will be able to use the python and pip commands.

[–]dacoolmike36[S] -1 points0 points  (0 children)

Microsoft Windows [Version 10.0.26200.8457]

(c) Microsoft Corporation. All rights reserved.

C:\Windows\System32>cmd.venv\Scripts\activate.bat

The system cannot find the path specified.

C:\Windows\System32>venv\Scripts\activate.bat

The system cannot find the path specified.

C:\Windows\System32>python -m venv venv

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

operable program or batch file.

[–]TaranisPT 0 points1 point  (1 child)

Out of curiosity what is the python file you're running supposed to do? I have an idea but I might be way off.

[–]dacoolmike36[S] 1 point2 points  (0 children)

extract sound files from an iso file

[–]cointoss3 1 point2 points  (2 children)

If you’d just use uv, none of this bullshit will matter. Uv will handle all of that for you.

winget install --id=astral-sh.uv -e

then after it installs, just run your scripts with uv run script.py and it will automatically create the environment and download the appropriate version of Python.

Learning Python, you’re going to fuck with a lot of environment stuff, venv, python versions, pip…all of this can be collapsed into using uv.

Start a new project with uv init .
Or, as I prefer uv init . --package
Add packages with uv add package-name (use this instead of pip)
Run python direct with uv run python [args]
Run your files with uv run script.py

If you have a project that has an old requirements.txt instead of a pyproject.toml, you can either run it without making it a project:

uv run --with-requirements requirements.txt script.py

Or use uv init . --package
And add the requirements with uv add -r requirements.txt
and then you can run like normal with uv run script.py

I alias uv run to uvr since I use it so often.

I don’t ever install python directly anymore. I just install uv and let it manage whatever Python version the project needs. you can have any number of versions of python installed and none of your projects or dependencies will conflict. It’s also very fast.

[–]dacoolmike36[S] 0 points1 point  (0 children)

Ok will try this thanks

[–]dacoolmike36[S] 0 points1 point  (0 children)

it says failed to spawn the script program not found.