Comment

Comment by hprotagonist

I do full time scientific python, and this post has some painfully wrong ideas.

>The official oletools install instructions talk about using either pip or setup.py. As a general rule, we're very strongly against installing anything system-wide except through Ubuntu's own package management system, and the environment our Python program runs in doesn't really have a home directory to use pip's --user option, so the obvious and simple pip invocations are out.

No! The obvious and simple pip invocation is as follows:

  python3 -m venv ${HOME}/myvenv
  ${HOME}/myvenv/bin/pip install foo bar baz oletools
  ${HOME}/myvenv/bin/pin install -e /path/to/my/installable/project
and then edit your code in `/path/to/my/installable/project/project-name/*.py` to your heart's content and tell your IDE or editor that `${HOME}/myvenv/bin/python` is the python to use. Activation is strictly optional, but if you like that, `source ${HOME}/bin/activate` (or use direnv to do it for you).

I would also recommend

  export PIP_REQUIRE_VIRTUALENV=1
I divorce what $USER thinks `python` means from the system python as soon as I can with `pyenv global 3.8.5`: https://github.com/pyenv/pyenv

Of course never, ever `sudo pip ... `.

And don't touch $PYTHONPATH unless someone has forced you to use Caffe, who should be shamed on a regular basis for being Bad At Packages.

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton