الثلاثاء، 30 أغسطس 2016

Setting up Python in Windows 10

Installing Python under Windows 10 operating system.
Ready? Here’s your quick guide:
Set up Python on Windows 10
1. Visit the official Python download page and grab the Windows installer for the latest version of Python 3. A couple of notes:
  • Python is currently available in two versions — Python 2 and Python 3. For beginners, that can be confusing. In short, Python 3 is where the language is going; Python 2 has a large base of existing users but isn’t developing beyond bug fixes. Read this for more.
  • By default, the installer provides the 32-bit version. There’s also a 64-bit version available. I’ve generally stuck with 32-bit for compatibility issues with some older packages, but installing is so easy you can experiment with either.
2. Run the installer. You’ll have two options — choose “Customize Installation.”
3. On the next screen, check all boxes under “Optional Features.” Click next.

4. Next, under “Advanced Options,” set the location where you want to install Python. For ease, I use:
C:\Python35-32
That refers to an installation of 32-bit Python 3.5.
5. Next, set the system’s PATH variable to include directories that include Python components and packages we’ll add later. To do this:
  • Open the Control Panel (easy way: right click the Start Menu icon and select Control Panel).
  • In the Control Panel, search for Environment; click Edit the System Environment Variables. Then click the Environment Variables button.
  • In the User Variables section, we will need to either edit an existing PATH variable or create one. If you are creating one, make PATH the variable name and add the following directories to the variable values section as shown, separated by a semicolon. If you’re editing an existing PATH, the values are presented on separate lines in the edit dialog. Click New and add one directory per line.
C:\Python35-32;C:\Python35-32\Lib\site-packages\;C:\Python35-32\Scripts\
6. Now, you can open a command prompt (Start Menu | Windows System | Command Prompt) and type:
python
That will load the Python interpreter:
Python 3.5.1  (v3.5.1:37a07cee5969, Dec 6 2015, 01:38:48) [MSC v.1900 32 bit (Intel)] on win 32
Type "help", "copyright", "credits" or license for more information.
>>>
Because of the settings you included in your PATH variable, you can now run this interpreter — and, more important, a script — from any directory on your system.
Type exit() and hit Return to exit the interpreter and get back to a C: prompt.
Optional: Set up useful Python packages
Python 3 comes with the package installer pip already in place, which makes it super easy to add useful packages to your Python installation. The syntax is this (replace some_package with a package name you want to install):
pip install some_package
1. Let’s add a couple of must-have utilities for web scraping: Requests and BeautifulSoup. You can use pip to install them all with one command:
pip install beautifulsoup4 requests
2. csvkit, which I covered here, is a great tool for dealing with comma-delimited text files. Add it:
pip install csvkit

You’re now set to get started using and learning Python under Windows 10. If you’re looking for a guide, start with the Official Python tutorial.

Source:
http://www.anthonydebarros.com/2015/08/16/setting-up-python-in-windows-10/

Have fun :) 

ليست هناك تعليقات:

إرسال تعليق