python from scratch
I seem to be setting up new computing environments frequently. Here's a recipe for making Python nice.
Use Miniconda to get a current Python distribution. Here is the download page directly.
-
Don't quite follow all of the detailed instructions. Do run the script you download:
The three shell arguments are:
-b Notify of job termination immediately. -p Turned on whenever the real and effective user ids do not match. -u Treat unset variables as an error when substituting.
(It's easier to find these by doing
help setat a terminal than it is by scrolling through the eternalbashman page.) -
Do activate the installed distribution. But don't invite to change all of your shell init scripts; we're going to do that on our own
-
Create two empty virtual environments in your home directory.
-
Edit your shell startup file, probably
.bashrc, to contain the following: -
Now, refresh your terminal:
-
Whenever you start a fresh terminal, you'll have this annoying empty Python installation, so something won't work the first time. If you are doing something quick and one-timey everyday stuff, install it in
.default_venv:(.empty_venv) $ venv_activate ~/.default_venv (.default_venv) $ pip install ipython scipy pandas seaborn plotly ...
But when you start a new project and something doesn't work, just put its venv there:
(.empty_venv) $ cd my/new/project/named/foo (.empty_venv) $ python -m venv .venv --prompt . (.empty_venv) $ venv_activate .venv (foo) $ pip install -r requirements.txt
The
--prompt .sets the little string in the prompt to the name of the current directory (at the time the .venv is made), which helps to keep them all your zillion little displosable.venvs straight.