Activating pyenv, moving current path, turning on iPython notebook is everyday chore before I play with python, and that’s tedious.
I made the .command file to execute these process by a double-click. You can put the .command file on a folder you want to use iPython, meaning that you don’t even have to change current path by “cd~”.
Note: My environment is Mac, python3.4, and pyenv-virtualenv for virtual environment.
eval "$(pyenv init -)" pyenv activate pyenv3.4.3_venv1 cd <code>dirname $0</code> ipython notebook
‘ eval “$(pyenv init -)” ‘ is the same code as one in .bash_profile that I added when I installed pyenv-virtualenv. If you type such activating command for pyenv and ipython in terminal, you don’t have to include the sentence. But It seems to be needed if you execute them in .command. Without this, you may receive the error message and fail to activate pyenv as I did:
Failed to activate virtualenv.
Perhaps pyenv-virtualenv has not been loaded into your shell properly.
Please restart current shell and try again.
dirname $0 ” change current path to the folder you execute the .command. So you don’t have to change path by “cd ~”. You can put the .command file on a folder you want to use in iPython.
I hope it will help you. If there is a wrong part, please report as comment.