AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Multiple python versions linux8/30/2023 ![]() ![]() Have two separate installs of Python, and run explicitly with the different versions. "Question2: Is there more elegant way to switch between version as my hack of symlinking was a virtual disaster?" Run mjango with /usr/bin/python2.4 and django with /usr/bin/python2.6. You simply run them with the specific python version they need. "Question1: How will i tell any framework that go and use version so and so pf python like day django to use 2.6 and say mjango to use 2.4?" Use the below command to disable the Pythonbrew and to activate the default version $pythonbrew offĮnjoy the experience of installing multiple versions of Python in single Linux / ubuntu machine! Use the below command to update the Pythonbrew $pythonbrew update To uninstall any of the installed Python version (for example to uninstall Python 2.7), use the below command. Use the below command to check or list the available Python Versions to install $pythonbrew list -k Use the below command to check or list the installed Python versions $pythonbrew list Now, to switch to Python 3.2 change the version number in the previous command. The default Python is changed to Python 2.7. How to manage different versions of Python installed in systemįor instance, if Python 2.6.6, Python 2.7 and Python 3.2 is installed in your system, switching between the versions can be done as follows:īy default, Python 2.6.6 will be active and in order to switch to Python 2.7 use the below command $pythonbrew switch 2.7 Update: If you get error while Installing then Install using the below command. This will install Python 2.6.6 and to install Python 2.7 or Python 3.2, change the version number in the previous command. Open a new terminal, type the following command or copy and paste it. Steps to Install different versions of Python: *NOTE: change “user” to your user name in the system source /home/user/.pythonbrew/etc/bashrc Next, copy and paste the following line to the end of ~/.bashrc Now the Pythonbrew has been installed in the “Home Directory” i.e., /home/user/.pythonbrew Then, run the pythonbrew-install in the terminal. curl -kLO Īfter downloading, change “pythonbrew-install” to “executable” chmod +x pythonbrew-install Use curl command to download the latest version of pythonbrew from github. To complete the installation, type the following command $pythonbrew_install Recomended method of installation - Easy Install $ sudo easy_install pythonbrew $sudo apt-get install curlĪfter Installing the curl, Now Install Pythonbrew, copy and paste the following commands in the terminal and type the password for the user when prompted. Dependencies – curlīefore Installing the Pythonbrew, Install “curl” in the machine, to install curl use the below command in the terminal, give the the password for the user when prompted. Pythonbrew is a program to automate the building and installation of Python in the users $HOME. Which can also be called as Python version manager similar to that of RVM-Ruby version manager but Pythonbrew is inspired by Perlbrew. So, virtualenv should be able to solve all of your problems. If I use easy_install it installs things into my new virtual environment. If I run python now it uses this new python. virtualenv -p python2.6 -no-site-packages ~/env/NEW_DJANGO_PROJECTĪnd then whenever I am doing anything related to this project I activate it: source ~/env/NEW_DJANGO_PROJECT/bin/activate This keeps all the packages tight together and allows me to have the specific versions of everything I need. I tend to create a new virtualenv for each project I'm working on and don't give it access to the global site-packages. To install virtualenv then do: easy_install virtualenv On ubuntu you can get easy_install like this: sudo apt-get install python-setuptools I use a Mac, and keep my system Python as whatever OS X sets as the default. ![]() You can install multiple versions of Python on your computer (I have 2.4, 2.5, 2.6 and 3.1 on my machine - I install each from source). You can then activate the appropriate environment when you need it. Using virtualenv you can create a new virtual python environment with whatever version of Python you want for each project or application. There is more information here: Working with virtualenv. ![]()
0 Comments
Read More
Leave a Reply. |