I usually develop with python 2.7, but would like to start creating some tools in python 3.x. What is the easiest way to have both running side-by-side, while keeping some semblance of control over what libraries I have installed where...
If I use pyenv
to switch between versions, will it propagate to a generic shebang line? Something like
#!/usr/bin/env python
or even better, can I specify which python in the shebang?
#!/usr/bin/env python3
I am anticipating a lot of "Use virtualenv
" replies. Is this really the only way to do it? I feel like I would like to have the "base" python on my system with whatever libraries I have installed so that I can change between the two environments by typing something simple like pyenv global 3.2.3
I am using OSX, Mountain Lion at the moment.
Trying to explain it a little better, I have two alternative questions:
If I use something like
virtualenv
, will I lose the ability to run python2 and python3 scripts alternately, without changing the environment (i.e., just via shebang)?In contrast, if I use two independent version installations, how can I control/know what will be installed by
pip
oreasy_install
for example.
UPDATE: Currently using python3
in the shebang line, and using pip3
to install packages to python3... Seems to work fine.