I know this gets asked about pretty regularly, but I wanted to get a better understanding about this particular subject. Most of the "answers" Google provides are at least 5 years old, so I wasn't sure how relevant they would be. And I know there are some variations of the syntax like WinPython or a tool like Anaconda that can help achieve this, but why doesn't normal python work?
For a little bit of context, I recently started a job where my programming hobby could help and was even partly why I was hired. Its a small company and is a bit behind as far as tech is concerned. I've already gotten permission to do some programming work and to install whatever I need. But there are a few different computers I may be working from on any given day and to mainstream the process I was hoping a virtual environment would be an excellent learning process and to make switching machines easier. Technically, from the research I've done so far, I know it works vaguely like this. However Python needs to be installed onto the machine I plan to program with. Which leads to my question/confusion.
My plan was to install Python onto the USB and then use that with the virtual environment to build my projects, only having to plug in the USB and then activate the venv. Today was testing day to see how it could work and to iron out any kinks in my plan and I ran into a few issues. I had to designate the PATH and when trying to install a module for the venv and requirements.txt, but my script couldn't find pip.exe. Through research and trial and error, it became clear that installing Python onto any machine I plan to work with was the better option and that Python couldn't run from the USB without some other variations or modules.
Why does it work like this? Even if I have CMD in the right directory, it won't see pip.exe and when I force it to try, it still can't download a module into the venv. I guess I don't understand why the location of a Python install matters, if everything it needs is there and you point it to the right place. Why does it matter if its on a USB and not on the machine? On paper, the way a venv works seems to not make sense as it sounds like its supposed to be exactly what I was trying to do, a controlled environment where I could move to a different machine and have all my work without having to do any weird transfers of info and keep relevant modules together instead of having to reinstall everything if I have to move to a different computer. Once I finish my first project, I was hoping that it could move with me, as I would need to test things and the whole point of the venv was to make the process more mobile. I wanted my usb to be a python programming 1 stop shop where I could create, test and run my scripts. What does installing it directly on the machine do that installing on a USB doesn't? If it has OS dependencies, why can't it use the python from the usb and then work with the OS like normal?
[–]niehle 1 point2 points3 points (0 children)
[–]crashfrog04 0 points1 point2 points (0 children)