Auto-tools/Python101: Difference between revisions

From MozillaWiki
Jump to navigation Jump to search
 
(3 intermediate revisions by 2 users not shown)
Line 3: Line 3:
==== Install Python ====
==== Install Python ====
*Go to: http://www.python.org/getit/  
*Go to: http://www.python.org/getit/  
*Make sure to get Python 2.6 or Python 2.7  
*Make sure to get Python 2.7  
*Choose the right platform and architecture (32bit or 64bit)
*Choose the right platform and architecture (32bit or 64bit)
* If using windows:
* If using windows:
** We suggest you use 32bit Python: There are still some native libraries available in 32bit only
** Figure out where python got installed (usually C:\Python27)
** Figure out where python got installed (usually C:\Python27)
** Add this directory to your $PATH environment variable
** Add this directory to your $PATH environment variable
** Also add C:\Python27\Scripts to your $PATH
** Also add C:\Python27\Scripts to your $PATH
** Many 32bit "Python Powered" native installs require a pointer to the python installation, but they have no idea where to look in 64bit windows. You must alter the registry (http://stackoverflow.com/questions/3652625/installing-setuptools-on-64-bit-windows):
::: <code>SET HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\PythonCore\2.7\InstallPath = "C:\Python27"</code>


==== Install Setuptools and Pip ====
==== Install Distribute and Pip ====
* Install setuptools from here: http://pypi.python.org/pypi/setuptools
* Install distribute from here: http://pypi.python.org/pypi/distribute
* Follow  installation instructions for your platform
* Follow  installation instructions for your platform
* Open up a command line and run 'easy_install pip'
* Open up a command line and run 'easy_install pip'
Line 20: Line 23:
* See http://pypi.python.org/pypi/virtualenv for usage instructions
* See http://pypi.python.org/pypi/virtualenv for usage instructions


==== Setup Virtualenvwrapper (optional) ====
==== Install Virtualenvwrapper (optional) ====
* Unix only, but very handy
* Unix only, but very handy
* See http://www.doughellmann.com/projects/virtualenvwrapper/ for installation and usage instructions
* See http://www.doughellmann.com/projects/virtualenvwrapper/ for installation and usage instructions

Latest revision as of 16:30, 14 October 2014

Setting up Python

Install Python

  • Go to: http://www.python.org/getit/
  • Make sure to get Python 2.7
  • Choose the right platform and architecture (32bit or 64bit)
  • If using windows:
    • We suggest you use 32bit Python: There are still some native libraries available in 32bit only
    • Figure out where python got installed (usually C:\Python27)
    • Add this directory to your $PATH environment variable
    • Also add C:\Python27\Scripts to your $PATH
    • Many 32bit "Python Powered" native installs require a pointer to the python installation, but they have no idea where to look in 64bit windows. You must alter the registry (http://stackoverflow.com/questions/3652625/installing-setuptools-on-64-bit-windows):
SET HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Python\PythonCore\2.7\InstallPath = "C:\Python27"

Install Distribute and Pip

Install Virtualenv

  • Run 'pip install virtualenv'
    • A virtualenv is an isolated environment that python packages can get installed to. Packages installed into a virtualenv are only available to you when that virtualenv is activated. The benefit of this is that your global python environment doesn't get cluttered and packages don't interfere with one another. It may not sound like much but if you start using Python a lot managing packages in your global environment becomes a real pain.
  • See http://pypi.python.org/pypi/virtualenv for usage instructions

Install Virtualenvwrapper (optional)