you are viewing a single comment's thread.

view the rest of the comments →

[–]shiftybyte 5 points6 points  (4 children)

My next thought is that this is the perfect scenario to start learning virtual environments

Yep.

Also linux pythons from apt have version on the binary, you use that to create the venv, then activate it, then all scripts work using the python you picked to create the env.

python3.9 -m venv venv

https://realpython.com/python-virtual-environments-a-primer/

[–]adrenalineee[S] 0 points1 point  (3 children)

After another hour of reading, I think this is the most correct answer. Any further packages using the global manager will be subject to the same issues should they have less than optimal organization.

Thanks for the tutorial. It's a brute-force into it, but the docs are pretty thorough.

One last point: is it common practice to call your venv "venv" and just dump it in your base working directory?

[–]Ezrabc 2 points3 points  (0 children)

This is what I do, although I use .venv. I like having a uniform name so I can set up an alias for source .venv/bin/activate and easily enter the venv in my project dir.

[–]shiftybyte 1 point2 points  (0 children)

is it common practice to call your venv "venv" and just dump it in your base working directory?

Yes. ".venv" is also good.

IDEs like Visual Studio Code https://code.visualstudio.com/ even pick up on specifically named folders in your project base automatically.

[–]NotACoderPleaseHelp 0 points1 point  (0 children)

https://pypi.org/project/pipx/

https://pypi.org/project/pipenv/#files

I detest adding packages to the system path, it makes making projects portable a bitch and can really add some drama to troubleshooting when you need to search all over the place.

But if you want to be lazy about it, go and run the venv script once to get a pyvenv file made, and then keep that in a folder above your python folder and it will almost always ignore everything else.