Skip to content

Instantly share code, notes, and snippets.

@chr15m
Created February 27, 2020 13:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chr15m/9540222f93eebbf8e42283f696ce5563 to your computer and use it in GitHub Desktop.
Save chr15m/9540222f93eebbf8e42283f696ce5563 to your computer and use it in GitHub Desktop.
Makefile rules to activate Python virtualenv for the whole Makefile
# get makefile's own path
mkfile_path := $(abspath $(lastword $(MAKEFILE_LIST)))
mkfile_dir := $(dir $(mkfile_path))
# add virtualenv in folder "virtualenv" to the path
export PATH := $(mkfile_dir)/virtualenv/bin:$(PATH)
export VIRTUAL_ENV=$(mkfile_dir)/virtualenv
example: something.py
python something.py # <- this will be called with virtualenv activated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment