Ubuntu under the Python upgrade, Django installation and upgrade.

Source: Internet
Author: User
Tags install django

1. Python Upgrade

Before the Ubuntu comes with a lower version of Python, the following method can be done to upgrade.

Use the command first: python-v to view the current Python version. Since 2.0 and 3.0 are syntactically different, upgrade to more than 3.0 here.

#     sudo apt-get update.  % upgrade package; #     sudo apt-get install python3.3

We have now downloaded the latest installation package. Then, we are under the/usr/bin/directory (some may use the command Whereis python in the/usrlocal/bin/directory to see how Python can be

Execute the path to the script) you can see the python3.3 just now.

# RM-RF  /usr/bin/python  %%%%%%% Delete the old link because the old Python is linked to the old Python program. # ln  -S/usr//bin/python3.3    %%%%%%%%%/usr/bin/python  creates a new link that makes Python point to the latest version of python3.3# python-v percent %%%%%% look at the new version.
2. Django Installation.

With Python installed, you can install Django, and servers like Apache can be installed without first installing them. There are several ways to install Django, and here we choose one. Download the installation package directly, then unzip the installation;

Address of the installation package: https://www.djangoproject.com/download/

We download the django-1.7.3.tar.gz version and then unzip it into the/opt/

[Email protected]:# tar-zxvf django-1.7.3.tar.gz[email protected]:/opt# cd django-1.7.3/

Then execute:

[Email protected]:/opt/django-1.7.3# python setup.py Install


It's ready to install.

Inspection:

[Email protected]:/opt/django-1.7.3# python  %%%%%%%% into python command line mode python 3.3.2+ (default, Oct  9 2013, 14:56:03 ) [GCC 4.8.1] on Linuxtype ' help ', ' copyright ', ' credits ' or ' license ' for more information.>>> import django>& Gt;> Django. Version (1, 7, 3, ' final ', 0)    %%%%%%%%% Displays the revision number. Installation is complete. >>>  
3. Upgrade Django

If we want to upgrade the installed Django, if it is installed in this way above, then we need to upgrade the following operation. That is, you can delete the Python dist-packages. Then re-install the method as described above. If it is installed with easy_install or PIP, it is possible to overwrite the old one directly.

[Email protected]:/#  python-c "Import sys; Sys.path = sys.path[1:]; Import Django; Print (django.__path__) "  %%%%% This step is designed to help find the path ['/usr/local/lib/python3.3/dist-packages/django '][email protected]:/# ls/usr/local/lib/python3.3/dist-packages/           Django  django-1.5.12.egg-info%%%%%%% This is my install 1.7.* Installed before the version. [Email protected]:/# rm-rf/usr/local/lib/python3.3/dist-packages/*   


Ubuntu under the Python upgrade, Django installation and upgrade.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.