I am trying to profile my pyopencl project with CodeXL, and in order to work with .py files. I can't think of anything better than pointing at Python.exe and passing path to script as an argument. What makes things complicated is my use of Anaconda virtual environment to resolve conflicts between modules, because this way it is impossible to simply point CodeXL at a python executable in some virtual environment - as far as I understand, this environment has to be activated first, and CodeXL does not support this.
How to get an executable Python path out of an Anaconda environment?
13.7k Views Asked by Mstislaw At
3
There are 3 best solutions below
1
On
You can find the location of your python exe using:
where python
Since you're using Anaconda, you can also try:
where anaconda
You'll find the python exe in the parent directory of the result.
If this isn't what you need, you can find more info here.
1
On
- This should give you a list of all the environments and their respective paths.
conda env list
copy the path of your desired environment and append
/binto it and call the python version, can be either python3 or python2In the end, your path should look like for python2
/<your_env_path>/bin/pythonand this for python3/<your_env_path>/bin/python3
The Python executable of a conda, virtualenv or venv environment is generally located at
EDIT: on Windows should be instead (at least for venv)
where
$ENVPATHis the environment path. To get a list of the environments you created along with their paths you can run (from the terminal)Alternatively, if you are using a Python interpreter and you want to know where its executable is located, you can run