python - Makefiles does not start conda environment -


i have makefile

.phony: start-generate  start-generate:     source activate myenv     mkdir "data_channels_`date +%y%m%d_%h%m%s`"     python main/datageneration.py ./"data_channels_`date +%y%m%d_%h%m%s`" 3 

but when run get

$ make start-generate source activate myenv make: source: command not found make: *** [start-generate] error 127 

although able run source activate myenv outside make.

if alternatively try

start-generate:     ( \         source activate myenv; \         mkdir "data_channels_`date +%y%m%d_%h%m%s`"; \         python main/datageneration.py ./"data_channels_`date +%y%m%d_%h%m%s`" 3; \     ) 

i error

/bin/sh: 2: source: not found traceback (most recent call last):   file "main/datageneration.py", line 1, in <module>     import pandas pd importerror: no module named pandas make: *** [start-generate] fehler 1 

the error pandas obviously, because source-command did not work. , regarding there message /bin/sh: 2: source: not found. maybe issue need /bin/bash instead of /bin/sh? if so, how it?

what issue here?

you can use python in virtualenv directly.

.phony: start-generate  start-generate:     mkdir "data_channels_`date +%y%m%d_%h%m%s`"     /abspath/python main/datageneration.py ./"data_channels_`date +%y%m%d_%h%m%s`" 3 

or can below:

how use virtualenv in makefile

start-generate:     ( bash -c "source activate myenv; \         mkdir "data_channels_`date +%y%m%d_%h%m%s`"; \         python main/datageneration.py ./"data_channels_`date +%y%m%d_%h%m%s`" 3" ) 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -