Today I have a project which requires several packages on my python.
However, due to whatever reason, I have a lot of different versions of python.
Before I thought, it was fine to just install and maintain each by each.
Maybe it is time to learn how to use virtualenv. (alternatively, you can use module).
I first got some quick ideas from here:
https://stackoverflow.com/questions/10763440/how-to-install-python3-version-of-package-via-pip-on-ubuntu
The magic virtualenv does is that, it copies a series of your python binaries, include, pip, etc., into a folder. The prepared activate script does that, add the export folder into the general variable PATH at its beginning.
By doing so, the targeted version of python will be the first target that will be executed.
To enable virtualenv, source the position of the above folder/bin/activate
To leave the virtualenv, just type deactivate, as it is defined when you load the activate script.
For example, I call virtualenv in my home directory:
virtualenv -p /usr/bin/python3.5 py3env
Then I get the py3env folder with the above mentioned files.
To apply "alternatives" method:
http://ubuntuguide.net/how-to-install-and-setup-gcc-4-1g4-1-in-ubuntu-10-0410-10
However, due to whatever reason, I have a lot of different versions of python.
Before I thought, it was fine to just install and maintain each by each.
Maybe it is time to learn how to use virtualenv. (alternatively, you can use module).
I first got some quick ideas from here:
https://stackoverflow.com/questions/10763440/how-to-install-python3-version-of-package-via-pip-on-ubuntu
The magic virtualenv does is that, it copies a series of your python binaries, include, pip, etc., into a folder. The prepared activate script does that, add the export folder into the general variable PATH at its beginning.
By doing so, the targeted version of python will be the first target that will be executed.
To enable virtualenv, source the position of the above folder/bin/activate
To leave the virtualenv, just type deactivate, as it is defined when you load the activate script.
For example, I call virtualenv in my home directory:
virtualenv -p /usr/bin/python3.5 py3env
Then I get the py3env folder with the above mentioned files.
To apply "alternatives" method:
http://ubuntuguide.net/how-to-install-and-setup-gcc-4-1g4-1-in-ubuntu-10-0410-10
Comments
Post a Comment