I have python2( as default environment) and python3 installed on redhat server and set up different alias for them.
.bashrc
alias myconda='export PATH="/root/anaconda3/bin:$PATH"'
I activate this alias by executing myconda on terminal. How can I activate it using python script as I need to run scrapy spider on python3?
Update: I want to integrate scrapy spider with flask as API. When POST method hit the endpoint url, then I want to run the scrapy spider. Currently spider runs fine individually.
I am trying to activate bash alias like this -
import subprocess
subprocess.Popen('myconda;scrapy crawl company_pro;', shell=True)
This doesn't identify myconda as alias and uses default python2 environment instead of python3 to start spider and gives python2 syntax errors and
/bin/sh: myconda: command not found. error
Thanks in advance.