Following best practice I have started an executable Python script with a shebang specific to Python 3:
#!/usr/bin/env python3
import spotipy
# ...some fancy code
One chmod +x
later, I'm executing this script as ./quick_example.py
but alas the executable found (running locally on my Mac) is not the Python executable in my active Conda environment, as running which python3
in my Bash shell throws up /usr/bin/python3
instead of the desired /Users/anilkeshwani/opt/miniconda3/envs/spot/bin/python
given by which python
.
Apparently using #!/usr/bin/env python
is bad practice in general, so my question is: can I keep the Python 3-specific shebang and somehow have Conda alias python3
calls when an env is active?