Skip to main content

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:

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

After installation, try to run:

pretext --help

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

  • One option is to try running python -m pretext --help. If that works, then you can use python -m pretext in place of pretext, and you won't need to do anything further.

  • To fix your “PATH” 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 your “PATH” 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 --helpagain.

Subsection 2.4 Upgrading

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

To upgrade your version, run the following:

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