2023-09-13 20:01:16 +03:00
|
|
|
Installation
|
|
|
|
============
|
|
|
|
|
|
|
|
Telethon is a Python 3 library, which means you need to download and install Python to use it.
|
|
|
|
Installing Python, using virtual environments, and the basics of the language, are outside of the scope of this guide.
|
|
|
|
|
|
|
|
You can find the official resources to `download Python <https://www.python.org/downloads/>`_,
|
|
|
|
learn about the `Python Setup and Usage <https://docs.python.org/3/using/index.html>`_ for different platforms,
|
|
|
|
or follow the `The Python Tutorial <https://docs.python.org/3/tutorial/index.html>`_ to learn the basics.
|
|
|
|
These are not necessarily the best resources to learn, but they are official.
|
|
|
|
Be sure to search online if you prefer learning in video form or otherwise.
|
|
|
|
|
|
|
|
You can confirm that you have Python installed with:
|
|
|
|
|
|
|
|
.. code-block:: shell
|
|
|
|
|
|
|
|
python --version
|
|
|
|
|
|
|
|
Which should print something similar to ``Python 3.11.5`` (or newer).
|
2023-10-16 21:12:16 +03:00
|
|
|
Be sure to run the command in a terminal such as PowerShell or Terminal.
|
|
|
|
The above won't work inside a Python shell!
|
|
|
|
If you had the terminal open before installing Python, you will probably need to open a new one.
|
2023-09-13 20:01:16 +03:00
|
|
|
|
|
|
|
|
|
|
|
Installing the latest stable version
|
|
|
|
------------------------------------
|
|
|
|
|
|
|
|
Once you have a working Python 3 installation, you can install or upgrade the ``telethon`` package with ``pip``:
|
|
|
|
|
|
|
|
.. code-block:: shell
|
|
|
|
|
|
|
|
python -m pip install --upgrade telethon
|
|
|
|
|
2023-10-16 21:12:16 +03:00
|
|
|
Be sure to use lock-files if your project!
|
|
|
|
The above is just a quick way to get started and install Telethon globally.
|
2023-09-13 20:01:16 +03:00
|
|
|
|
|
|
|
|
|
|
|
Installing development versions
|
|
|
|
-------------------------------
|
|
|
|
|
|
|
|
If you want the *latest* unreleased changes, you can run the following command instead:
|
|
|
|
|
|
|
|
.. code-block:: shell
|
|
|
|
|
|
|
|
python -m pip install --upgrade https://github.com/LonamiWebs/Telethon/archive/v2.zip
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
The development version may have bugs and is not recommended for production use.
|
|
|
|
However, when you are `reporting a library bug <https://github.com/LonamiWebs/Telethon/issues/>`,
|
|
|
|
you must reproduce the issue in this version before reporting the problem.
|
|
|
|
|
|
|
|
|
|
|
|
Verifying the installation
|
|
|
|
--------------------------
|
|
|
|
|
|
|
|
To verify that the library is installed correctly, run the following command:
|
|
|
|
|
|
|
|
.. code-block:: shell
|
|
|
|
|
|
|
|
python -c "import telethon; print(telethon.__version__)"
|
|
|
|
|
|
|
|
The version number of the library should show in the output.
|