The engine.path
argument can be used to set which python to use.
'''{python eval=TRUE, engine.path='/Users/mingchen/anaconda/bin/python'}
import sys
for i in sys.path:
print(i)
'''
To set a global engine path, we can specify the engine path in the setup chunk. The engine.path
accepts a list, which allows setting path for multiple different engines.
'''{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE, eval = TRUE,
engine.path = list(python = '/Users/mingchen/anaconda/bin/python',
perl = '/usr/local/bin/perl')))
'''
##
## /Users/mingchen/anaconda/lib/python36.zip
## /Users/mingchen/anaconda/lib/python3.6
## /Users/mingchen/anaconda/lib/python3.6/lib-dynload
## /Users/mingchen/anaconda/lib/python3.6/site-packages
## /Users/mingchen/anaconda/lib/python3.6/site-packages/Sphinx-1.5.6-py3.6.egg
## /Users/mingchen/anaconda/lib/python3.6/site-packages/aeosa
## /Users/mingchen/anaconda/lib/python3.6/site-packages/setuptools-27.2.0-py3.6.egg