'How to invoke the correct anaconda python in a script?
When writing a python script, usually we put #!/usr/bin/python in the first line.
However I use python with ananconda. So I activate an environment and when I do which python I get
/home/mememe/miniconda3/envs/myenvironment/bin/python
As you can see this path is dependent on my user name mememe :) and the name of the environment myenvironment
What should I write so that I can invoke the correct python which is the one for the environment I created?
Solution 1:[1]
This should work: substitute the first line with
with
#!/usr/bin/env /full/path/to/yourenv/bin/python
using the full path for the Python executable in your environment, so
#!/usr/bin/env /home/mememe/miniconda3/envs/myenvironment/bin/python
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
