python2.7 Installation of cloud servers

Source: Internet
Author: User

2, Installation python2.7


The machine comes with a python2.4.3 version; however, many new features are based on 2.7来, such as multi-process, adorner, etc.;

Therefore, you need to prepare the Python environment;



Python Environment Preparation:

wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz tar zxf python-2.7.3.tgz cd Python-2.7.3. Configure--prefix=/usr/local/python27 make do install ln-sf/usr/local/python27/bin/python2.7/usr/local/bin/ python2.7

Ln-sf/usr/local/python27/bin/python2.7/usr/local/bin/python

sudo vi. bash_profile

Path=/usr/local/bin: $PATH

In this way, Python can be used directly;

[Email protected] python-2.7.3]$ Python--version

Python 2.7.3

[Email protected] python-2.7.3]$

Then install Setuptools, which is easy_install.

wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz#md5= 7df2a529a074f613b509fb44feefe74e tar zxf setuptools-0.6c11.tar.gz cd setuptools-0.6c11 python2.7 setup.py Install

File "/usr/local/python27/lib/python2.7/distutils/dist.py", line 972, in Run_command

Cmd_obj.run ()

File "/home/admin/software/setuptools-0.6c11/setuptools/command/bdist_egg.py", line 236, in Run

Dry_run=self.dry_run, Mode=self.gen_header ())

File "/home/admin/software/setuptools-0.6c11/setuptools/command/bdist_egg.py", line 527, in Make_zipfile

z = zipfile. ZipFile (zip_filename, mode, compression=compression)

File "/usr/local/python27/lib/python2.7/zipfile.py", line 681, in __init__

"Compression requires the (missing) zlib module"

Runtimeerror:compression requires the (missing) zlib module

Zlib official website: http://www.zlib.net Download the source code to install the Zlib package. Currently the latest version of Zlib is zlib1.2.3, installation begins; $wget Http://www.zlib.net/zlib-1.2.3.tar.gz$tar-xvzf ZLIB-1.2.3.TAR.GZ$CD Zlib-1.2.3.tar.gz$./configure$make$sudo make Install


After installation, re-install the python2.7 once;

Python build finished, but the necessary bits-to-build these modules were not found:

_BSDDB _curses _curses_panel

_ssl _tkinter

bsddb185 bz2 dbm

DL GDBM Imageop

ReadLine Sunaudiodev

To find the necessary bits, look in setup.py in Detect_modules () for the module ' s name.


ln-sf/usr/local/python27/bin/easy_install-2.7/usr/local/bin/easy_install-2.7

Ln-sf/usr/local/python27/bin/easy_install-2.7/usr/local/bin/easy_install


Easy_install

Traceback (most recent):

File "/usr/local/bin/easy_install", line 5, in?

From pkg_resources import Load_entry_point

Importerror:no module named Pkg_resources

Re-python2.7 install Easy_install; re-execute, unable to find package:


196 Wget-c http://www.openssl.org/source/openssl-1.0.1e.tar.gz

197 Tar xzvf openssl-1.0.1e.tar.gz

198 CD OPENSSL-1.0.1E

199./config--prefix=/usr/local/openssl

Make

OK, now if you want to use your own Python, then run the corresponding py file directly, if you want to use the installed Python2.7, then use "python2.7 xxx.py".

Using Easy_install is also, comes with the direct run "Easy_install xxx", corresponding to Python2.7 run "easy_install2.7 xxx".


python2.7 Installation of cloud servers

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.