Installing Python on Windows
First, download the latest version of Python 2.7 from the official Website. If you want to be sure you are installing a fully up-to-date version then use the “Windows Installer” link from the home page of the Python.org web site .The Windows version is provided as an MSI package. To install it manually, just double-click the file. The MSI package format allows Windows administrators to automate installation with their standard tools.
By design, Python installs to a directory with the version number embedded, e.g. Python version 2.7 will install at C:\Python27\, so that you can have multiple versions of Python on the same system without conflicts.
Of course, only one interpreter can be the default application for Python file types. It also does not automatically modify the PATH environment variable, so that you always have control over which copy of Python is run.
Typing the full path name for a Python interpreter each time quickly gets tedious, so add the directories for your default Python version to the PATH. Assuming that your Python installation is in C:\Python27\, add this to your PATH:
Distribute + Pip
The most crucial third-party Python software of all is Distribute, which
extends the packaging and installation facilities provided by the distutils in
the standard library. Once you add Distribute to your Python system you can
download and install any compliant Python software product with a single
command. It also enables you to add this network installation capability to
your own Python software with very little work.
To obtain the latest version of Distribute for Windows, run the python script available here: python-distribute
You’ll now have a new command available to you: easy_install. It is considered by many to be deprecated, so we will install its replacement: pip. Pip allows for uninstallation of packages, and is actively maintained, unlike easy_install.
To install pip, simply open a command prompt and run
To obtain the latest version of Distribute for Windows, run the python script available here: python-distribute
You’ll now have a new command available to you: easy_install. It is considered by many to be deprecated, so we will install its replacement: pip. Pip allows for uninstallation of packages, and is actively maintained, unlike easy_install.
To install pip, simply open a command prompt and run
Virtualenv
After Distribute & Pip, the next development tool that you should install is virtualenv. Use pipTo set up a new Python environment, change the working directory to where ever you want to store the environment, and run the virtualenv utility in your project’s directory
To use an environment, run the activate.bat batch file in the Scripts subdirectory of that environment. Your command prompt will change to show the active environment. Once you have finished working in the current virtual environment, run the deactivate.bat batch file to restore your settings to normal.
python with other operation systems
if you are having linux operation system like ubuntu ,debeian, python code can be written as scripts and saved in text files with the .py extension. There’s also a shell interpreter that makes it very easy to get started just by typing
python into your shell prompt. For now, that’s what we’ll be using to show some of the basic language principles.
Go ahead and fire up a terminal window and type
python. If you have Python installed, you’ll get a message like this:Tip: The three angle brackets are the standard Python command prompt which lets you know you’re now using the Python interpreter. Any time you see code snippets written with the >>> you know the author is referring to the Python shell.
No comments:
Post a Comment