1.2. Installation

1.2.1. Installation from PyPI

Pyarmor packages are published on the PyPI. The preferred tool for installing packages from PyPI is pip. This tool is provided with all modern versions of Python.

On Linux or MacOS, you should open your terminal and run the following command:

$ pip install -U pyarmor

On Windows, you should open Command Prompt (Win-r and type cmd) and run the same command:

C:\> pip install -U pyarmor

After installation, type pyarmor --version on the command prompt. If everything worked fine, you will see the version number for the Pyarmor package you just installed.

Installation from PyPI also allows you to install the latest development release. You will not generally need (or want) to do this, but it can be useful if you see a possible bug in the latest stable release. To do this, use the --pre flag:

$ pip install -U --pre pyarmor

If you need generate obfuscated scripts to run in other platforms, install pyarmor.cli.runtime:

$ pip install pyarmor.cli.runtime

Not all the platforms are supported, more information check Building Environments Installed command

  • pyarmor is the main command to do everything. See Man Page.
  • pyarmor-7 is used to call old commands, it equals bug fixed Pyarmor 7.x Start Pyarmor by Python interpreter

pyarmor is same as the following command:

$ python -m pyarmor.cli

1.2.2. Using virtual environments

When installing Pyarmor using pip, use virtual environments which could isolate the installed packages from the system packages, thus removing the need to use administrator privileges. To create a virtual environment in the .venv directory, use the following command:

$ python -m venv .venv

You can read more about them in the Python Packaging User Guide.

1.2.3. Installation from source

You can install Pyarmor directly from a clone of the Git repository. This can be done either by cloning the repo and installing from the local clone, on simply installing directly via git:

$ git clone https://github.com/dashingsoft/pyarmor
$ cd pyarmor
$ pip install .

You can also download a snapshot of the Git repo in either tar.gz or zip format. Once downloaded and extracted, these can be installed with pip as above.

1.2.4. Run Pyarmor from Python script

Create a script tool.py, pass arguments by yourself

from pyarmor.cli.__main__ import main_entry

args = ['gen', 'foo.py']

Run it by Python interpreter:

$ python tool.py

1.2.5. Clean uninstallation

Run the following commands to make a clean uninstallation:

$ pip uninstall pyarmor
$ pip uninstall pyarmor.cli.core
$ pip uninstall pyarmor.cli.runtime
$ rm -rf ~/.pyarmor
$ rm -rf ./.pyarmor


The path ~ may be different when logging by different user. $HOME is home path of current logon user, check the environment variable HOME to get the real path.