"Python" How to install Python and networkx under the Windows operating system

Source: Internet
Author: User

Networkx is a set of Python-based network construction libraries. Because I didn't learn python before, so a little bit, this article tells you how to install Python2.7 and networkx in a Windows environment.


First of all, to clarify, if you want to learn more about Python in the system, or to change the Linux system as soon as possible, because the library installation under Windows is very cumbersome, and Linux only need to run the command line (Terminal):

sudo apt-get install Python-matplotlib

You can do it.


Because it's just a matter of using NETWORKX to construct the data, here's a simple way to quickly install and use Python2.7 under Windows.


0. Leave a mark first: Python Beginner's Guide

Https://wiki.python.org/moin/BeginnersGuide


1. Download Python 2.7, double-click Install

https://www.python.org/downloads/windows/

Add Path variable: at < Start > menu-Control panel-system and security-system-advanced System Settings-(Advanced Tab)-environm Ental Variables-Find ' path ', double-click Open-Add path ' C:\Python27 ' (System installation folder), OK.

Confirm installation: In < Start > menu-run cmd-go to command line, enter ' Python ', display

Python 2.7.8 (default, June 30 2014, 16:08:48)

The installation is successful.

(Enter exit () to exit Python)


2. Before installing NETWORKX, you need to download and install the Setuptools:

Https://pypi.python.org/pypi/setuptools

In the Python27 folder, double-click Automatic installation.


3. Download the Networkx, unzip the folder, and copy it to the Python27 folder:

https://pypi.python.org/pypi/networkx/

Enter the Networkx folder under CMD Window command line and enter the ' Python setup.py install ' installation Networkx Library.

Setup is complete.


4. Test procedure:

Enter Python under any path of CMD and use the mini-test program to confirm the installation success!

Http://networkx.github.io/examples.html

The procedure is as follows:

>>> import Networkx as nx>>> g=nx. Graph () >>> g.add_node ("spam") >>> G.add_edge ($) >>> print (G.nodes ()) [1, 2, ' spam ']> >> print (G.edges ()) [(1, 2)]


5. Tutorial with Networkx:

Https://networkx.github.io/documentation/latest/overview.html

Networkx Network generation function:

Http://networkx.lanl.gov/reference/generators.html#module-networkx.generators.random_graphs



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.