Problem Statement:
A bash script is being used to create a new screen session for each name from a list of names. At every name, a python script is run using that name as an input. The bash script sets the path containing the correct version of python (python 3 in the anaconda package):
#!/bin/sh
export PATH=~/anaconda3/bin/python:$PATH
while read p; do
screen -dm -S $p bash -c "cd /inside/home/thjmatth/essential; python3 essentialpairs_ttest_tissue_1.py; exec sh"
done <cells.txt
Setting the path as above didn't allow the correct version of python to run, so I added the following shebang to the python script to run:
#!~/anaconda3/bin/python python3
Still no dice: /usr/bin/python
is still being used when it shouldn't. How can I have this program run the version of python according to the path I specify?
Attempt 1:
new shebang:
#!/inside/home/thjmatth/anaconda3/bin/python/
new bash script:
#!/bin/sh
export PATH=~/anaconda3/bin/python:$PATH
while read p; do
screen -dm -S $p bash -c "cd /inside/home/thjmatth/essential; python3 essentialpairs_ttest_tissue_1.py; exec sh"
done <cells.txt
new permissions on the python script:
chmod +x essentialpairs_ttest_tissue_1.py
error:
bash: python3: command not found
running which python in that screen still shows /usr/bin/python
Solution:
Same as Attempt 1 above, but changed line 3 of the bash script to make it a directory rather than an executable:
export PATH=~/anaconda3/bin/python:$PATH