Installation
Keywords: Authored in PreTeXt

Skip to main content
\(\newcommand{\foo}{bar} \newcommand{\lt}{<} \newcommand{\gt}{>} \newcommand{\amp}{&} \)

## Section 2 Installation

### Subsection 2.1 Python

PreTeXt-CLI requires Python version 3.6 or better.

To check your version, type this into your terminal or command prompt:

    python -V

If your version is 2.x, try this instead (and if so, either replace all future references to `python` in these instructions with `python3`, or try this).

    python3 -V

If you don't have a compatible Python available, try one of these:

- https://www.python.org/downloads/
  - Windows warning: Be sure to select the option adding Python to your Path.
- https://github.com/pyenv/pyenv#installation (Mac/Linux) or https://github.com/pyenv-win/pyenv-win#installation (Windows)

### Subsection 2.2 Other Dependencies

Some features of PreTeXt rely on some non-Python applications. TODO: Document these.

### Subsection 2.3 PreTeXt-CLI

Once you've confirmed that you're using a valid version of Python, just run (replacing `python` with `python3` if necessary):

    python -m pip install --user pretextbook

(It's possible you may get an error like `error: invalid command 'bdist_wheel'` — good news, you can ignore it!)

After installation, if you didn't see an error like “WARNING: The script pretext is installed in '[file_path]' which is not on PATH.”, then try to run:

    pretext --help

If that works, great! Otherwise, it likely means that Python packages aren't available on your “PATH”.

- To fix this on Linux/Mac, run the following commands:

      echo "export PATH=\"`python -m site --user-base`/bin:$PATH\"" >> ~/.bash_profile
      echo "export PATH=\"`python -m site --user-base`/bin:$PATH\"" >> ~/.zprofile

- To fix this on Windows, open your Windows Control Panel, search for “environment”, and select “Edit environment variables for your account”

  Then edit your PATH variable and add the following line (replacing `3x` with the version of Python you installed, e.g. `38` for version `3.8`):

      %USERPROFILE%\AppData\Roaming\Python\Python3x\Scripts

Then close and reopen your command line and try `pretext --help`again.

### Subsection 2.4 Upgrading

The most recent version of PreTeXt-CLI is 0.1.1rc0 . Use `pretext --version` to see the version you're running.

To upgrade your version, run the following:

    python -m pip install --user pretextbook --upgrade