r/Python • • Apr 30 '18

xkcd: Python Environment

Post image
2.4k Upvotes

388 comments sorted by

View all comments

47

u/ccb621 Apr 30 '18

My setup on macOS

  1. Install Python via packages at Python.org. (Using Homebrew for this never made sense to me.)

  2. Every project has its own virtualenv.

I don’t recall ever needing sudo. I’ve never had any of the issues described in the comic.

7

u/code_mc Apr 30 '18

Same, I've also always found python to have the best dependency management of all programming languages I've used.

8

u/batisteo Apr 30 '18

Don't use Rust/Cargo then :-*

→ More replies (2)

5

u/TomBombadildozer Apr 30 '18

Install Python via packages at Python.org. (Using Homebrew for this never made sense to me.)

Because the installers at Python.org used to (may still) fuck up the system Python distribution.

2

u/ccb621 Apr 30 '18

I've never had an issue with those packages in over four years. YMMV.

→ More replies (1)

2

u/Log2 Apr 30 '18 edited May 01 '18

In fact, if every project has it's pretty virtualenv, then using sudo to install something would install to the wrong interpreter (the one available to root).

You also never should need sudo to install something to a virtualenv because they exist within your home.

Only problem is installing stuff you want available without needing to use a virtualenv, such as a CLI. You can still install with pip --user, but your can't install conflicting dependencies.

3

u/meandertothehorizon It works on my machine May 01 '18

Use PIP_VIRTUALENV_REQUIRED=true so this can never happen accidentally (if you’re using pip exclusively obviously).

→ More replies (7)