1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147
|
============
Installation
============
Prerequisites
-------------
* Python interpreter
* Adjust your path
* Packaging tools
Python interpreter
^^^^^^^^^^^^^^^^^^
Install Python for your operating system.
On Windows and macOS this is usually necessary.
Most Linux distributions come with Python pre-installed.
Consult the official `Python documentation <https://docs.python.org/3/using/index.html>`_ for details.
You can install the Python binaries from `python.org <https://www.python.org/downloads/>`_.
Alternatively on macOS, you can use the `homebrew <http://brew.sh/>`_ package manager.
.. code-block:: bash
brew install python3
Adjust your path
^^^^^^^^^^^^^^^^
Ensure that your ``bin`` folder is on your path for your platform. Typically ``~/.local/`` for UNIX and macOS, or ``%APPDATA%\Python`` on Windows. (See the Python documentation for `site.USER_BASE <https://docs.python.org/3/library/site.html#site.USER_BASE>`_ for full details.)
UNIX and macOS
""""""""""""""
For bash shells, add the following to your ``.bash_profile`` (adjust for other shells):
.. code-block:: bash
# Add ~/.local/ to PATH
export PATH=$HOME/.local/bin:$PATH
Remember to load changes with ``source ~/.bash_profile`` or open a new shell session.
Windows
"""""""
Ensure the directory where cookiecutter will be installed is in your environment's ``Path`` in order to make it possible to invoke it from a command prompt. To do so, search for "Environment Variables" on your computer (on Windows 10, it is under ``System Properties`` --> ``Advanced``) and add that directory to the ``Path`` environment variable, using the GUI to edit path segments.
Example segments should look like ``%APPDATA%\Python\Python3x\Scripts``, where you have your version of Python instead of ``Python3x``.
You may need to restart your command prompt session to load the environment variables.
.. seealso:: See `Configuring Python (on Windows) <https://docs.python.org/3/using/windows.html#configuring-python>`_ for full details.
**Unix on Windows**
You may also install `Windows Subsystem for Linux <https://msdn.microsoft.com/en-us/commandline/wsl/install-win10>`_ or `GNU utilities for Win32 <http://unxutils.sourceforge.net>`_ to use Unix commands on Windows.
Packaging tools
^^^^^^^^^^^^^^^
See the Python Packaging Authority's (PyPA) documentation `Requirements for Installing Packages <https://packaging.python.org/en/latest/installing/#requirements-for-installing-packages>`_ for full details.
Install cookiecutter
--------------------
At the command line:
.. code-block:: bash
python3 -m pip install --user cookiecutter
Or, if you do not have pip:
.. code-block:: bash
easy_install --user cookiecutter
Though, pip is recommended, easy_install is deprecated.
Or, if you are using conda, first add conda-forge to your channels:
.. code-block:: bash
conda config --add channels conda-forge
Once the conda-forge channel has been enabled, cookiecutter can be installed with:
.. code-block:: bash
conda install cookiecutter
Alternate installations
-----------------------
**Homebrew (Mac OS X only):**
.. code-block:: bash
brew install cookiecutter
**Void Linux:**
.. code-block:: bash
xbps-install cookiecutter
**Pipx (Linux, OSX and Windows):**
.. code-block:: bash
pipx install cookiecutter
Upgrading
---------
from 0.6.4 to 0.7.0 or greater
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
First, read :doc:`HISTORY` in detail.
There are a lot of major changes.
The big ones are:
* Cookiecutter no longer deletes the cloned repo after generating a project.
* Cloned repos are saved into `~/.cookiecutters/`.
* You can optionally create a `~/.cookiecutterrc` config file.
Or with pip:
.. code-block:: bash
python3 -m pip install --upgrade cookiecutter
Upgrade Cookiecutter either with easy_install (deprecated):
.. code-block:: bash
easy_install --upgrade cookiecutter
Then you should be good to go.
|