Как подключить PyGame в PyCharm?
Как подключить библиотеку PyGame в PyCharm? Команда pip install pygame не работает. Добавление различных букв (w, u и др.) также не помогает. Попытки подключения библиотеки через Python также не дают результата. На официальном сайте PyGame полезной информации нет. Только pip install pygame для подключения.
Отслеживать
задан 21 янв в 19:47
47 6 6 бронзовых знаков
1) Ставите pygame в интерпретатор питона 2) В PyCharm у текущего проекта в настройках проекта указываете тот интерпретатор, в который ставили 3) Профит
21 янв в 19:50
Возможно, у вас в проекте в PyCharm есть питон в виртуальном окружении. В той же настройке проекта можно установить библиотеки через +
21 янв в 19:55
Спасибо за помощь, но я ничего не понимаю. Что за виртуальное окружение? Подозреваю, что у меня нет этого виртуального окружения. Я пытался запустить через IDLE, Консоль Python и в самом Python. Не знаю есть ли среди перечисленного интерпретатор. Также PyCharm на английском, а я английский не знаю, поэтому не знаю куда нажимать в настройках
22 янв в 10:00
Добавил описание в качестве ответа — комментарии для такого плохо предназначены 😀
22 янв в 10:48
1 ответ 1
Сортировка: Сброс на вариант по умолчанию
- Открываете меню File/Settings.
- Переходите в Project/Python Interpreter
Там можно выбрать (1) или создать (2) интерпретатор питона, а так же устанавливать (3) в них библиотеки.
Выбранный там интерпретатор будет использоваться при запуске скриптов в проекте
Отслеживать
ответ дан 22 янв в 10:47
76.8k 6 6 золотых знаков 55 55 серебряных знаков 122 122 бронзовых знака
Спасибо ещё раз. Сейчас более понятно. Зашёл куда было сказано и нажал там +, в новом окне ввёл ‘pygame’ и нажал install. Потом высветилось «Package ‘pygame’ installed successfully». И я закрыл то окно, но в изначальном окне было «Error occurred when installing package ‘pygame'». Я посмотрел подробнее и там было «Troubleshooting steps: 1. Try reading PyCharm guide on troubleshooting package installation. 2. Try installing this package by running the following comands is the terminal. If the command crashes in the terminal, the problem is out of IDE control.» Но по итогу всё работает, проверял.
22 янв в 12:48
Добавлю ещё, что в окне деталей о ошибке при установке было внутреннее окно с текстом. Я его через переводчик перевёл и там сказано, что отсутствует файл setup, поэтому будет через windows что-то делаться (я не помню точно). Надеюсь, что это не что-то важное.
Add pygame module in PyCharm IDE
I’ve downloaded pygame-1.9.1release.tar.gz from the Pygame website. I extracted and installed it and it’s working fine in the command line Python interpreter in Terminal (Ubuntu). But I want to install it for some IDE, like PyCharm. How can I do it?
117k 27 27 gold badges 238 238 silver badges 440 440 bronze badges
asked Feb 11, 2015 at 12:01
lavee_singh lavee_singh
1,399 1 1 gold badge 13 13 silver badges 21 21 bronze badges
What do you mean «install it for some IDE»? Is your PyCharm project using an interpreter (see e.g. jetbrains.com/pycharm/quickstart/configuring_interpreter.html) that has access to pygame ? Is it using the same one as the command line (use which python to find out)?
Feb 11, 2015 at 12:04
Got it after interpreter configuration. Thanks for the advise. But it’s still not working for IDLE(using python2.7) because it has it’s own interpreter.
Feb 11, 2015 at 12:28
If you want to run IDLE with a specific interpreter, use /path/to/python -m idlelib
Feb 11, 2015 at 12:29
Yes, on the command line.
Feb 11, 2015 at 13:16
5 Answers 5
Well, you don’t have to download it for PyCharm here. You probably know how it checks your code. Through the interpreter! You don’t need to use complex command lines or anything like that. You need to is:
- Download the appropriate interpreter with PyGame included
- Open your PyCharm IDE (Make sure it is up to date)
- Go to File
- Press Settings (Or Ctrl + Alt + S)
- Double click on the option that looks like Project: Name_of_Project
- Click on Project Interpreter
- Choose the interpreter you want to use that includes PyGame as a module
- Save your options
And you are ready to go! Here is an alternate (I have never done this, please try to test it)
- Add PyGame in the same folder as your PyCharm file (Your PyCharm stuff is always in a specific file placed by you during installation/upgrade) Please consider putting your PyCharm stuff inside a folder for easy access.
#2 — Установка среды разработки

Перед изучением языка Python сперва необходимо выполнить установку среды разработки и установку самого Питона на компьютер. В ходе видео мы установим Питон и программу PyCharm для написания кода в будущих уроках.
Видеоурок
Полезные ссылки:
- Официальный сайт Python;
- Программа PyCharm .
Установка среды разработки всегда отнимает много времени, так как приходиться все скачивать и настраивать. В уроке мы расскажем процесс установки Python на Windows .
Как установить Python на Windows?
Первым делом потребуется скачать Питон на компьютер. Для этого перейдите на официальный сайт и скачайте последнюю версию Питона. Для скачивания есть две разные версии: Python 2 и Python 3. В курсе рассматривается новая версия, поэтому спокойно качайте Питон версии 3.

После скачивания нажмите два раза на установщик и у вас запуститься программа установки Питона. В открывшемся окне установите галочку Add Python X.Y to PATH , затем нажмите на кнопку «Установить» для установки Python.

Язык Python будет готов к использованию сразу же после установки. Вам останется лишь протестировать его работоспособность.
Во вкладке «Пуск» должна появиться новая папка, в которой можно запустить IDLE. Если такой папки нет, то попробуйте найти программу вручную.
IDLE — это встроенная среда разработки, в которой можно работать с языком Питон. Также вы можете проверить работоспособность в консоле (терминале). Для этого отройте консоль и введите «python3». Если ничего не произошло, тогда попробуйте ввести просто слово «python» и нажать Enter .
Среда разработки
В качестве среды разработки вы можете использовать любую подходящую программу. В ходе курса мы будем использовать одну из наиболее надежных программ – PyCharm.
Если вам больше по душе другая программа, то можете использовать её. Главное необходимо убедиться что ваша программа имеет поддержку языка Питон.
Указание пути к файлу
Чтобы указать путь к файлу на Windows необходимо использовать пример следующей конструкции: «C:\Users\USER\Downloads\ФАЙЛ.py».
Вывод информации
print("Hello itProger")
Задание к уроку
Правильный запуск
Создайте файл и запустите его через терминал. При запуске файла в терминале должно быть выведено сообщение: «Python is working».
Посмотреть ответ
Создайте пустой Python файл «file.py». Чтобы запустить файл пропишите команду «python file.py» или же «python3 file.py».
В файле пропишите код:
print("Python is working")
Большое задание по курсу
Вам необходимо оформить подписку на сайте, чтобы иметь доступ ко всем большим заданиям. В задание входит методика решения, а также готовый проект с ответом к заданию.
PS: подобные задания доступны при подписке от 1 месяца
How to Install PyInstaller¶
PyInstaller is available as a regular Python package. The source archives for released versions are available from PyPi, but it is easier to install the latest version using pip:
pip install pyinstaller
To upgrade existing PyInstaller installation to the latest version, use:
pip install --upgrade pyinstaller
To install the current development version, use:
pip install https://github.com/pyinstaller/pyinstaller/tarball/develop
To install directly using pip’s built-in git checkout support, use:
pip install git+https://github.com/pyinstaller/pyinstaller
or to install specific branch (e.g., develop ):
pip install git+https://github.com/pyinstaller/pyinstaller@develop
Installing from the source archive¶
The source code archive for released versions of PyInstaller are available at PyPI and on PyInstaller Downloads page.
Even though the source archive provides the setup.py script, installation via python setup.py install has been deprecated and should not be used anymore. Instead, run pip install . from the unpacked source directory, as described below.
- Unpack the source archive.
- Move into the unpacked source directory.
- Run pip install . from the unpacked source directory. If installing into system-wide python installation, administrator privilege is required.
The same procedure applies to installing from manual git checkout:
git clone https://github.com/pyinstaller/pyinstaller cd pyinstaller pip install .
If you intend to make changes to the source code and want them to take effect immediately, without re-installing the package each time, you can install it in editable mode:
pip install -e .
For platforms other than Windows, GNU/Linux and macOS, you must first build the bootloader for your platform: see Building the Bootloader . After the bootloader has been built, use the pip install . command to complete the installation.
Verifying the installation¶
On all platforms, the command pyinstaller should now exist on the execution path. To verify this, enter the command:
pyinstaller --version
The result should resemble 4.n for a released version, and 4.n.dev0-xxxxxx for a development branch.
If the command is not found, make sure the execution path includes the proper directory:
- Windows: C:\PythonXY\Scripts where XY stands for the major and minor Python version number, for example C:\Python38\Scripts for Python 3.8)
- GNU/Linux: /usr/bin/
- macOS (using the default Apple-supplied Python) /usr/bin
- macOS (using Python installed by homebrew) /usr/local/bin
- macOS (using Python installed by macports) /opt/local/bin
To display the current path in Windows the command is echo %path% and in other systems, echo $PATH .
If you cannot use the pyinstaller command due to the scripts directory not being in PATH , you can instead invoke the PyInstaller module, by running python -m PyInstaller (pay attention to the module name, which is case sensitive). This form of invocation is also useful when you have PyInstaller installed in multiple python environments, and you cannot be sure from which installation the pyinstaller command will be ran.
Installed commands¶
The complete installation places these commands on the execution path:
- pyinstaller is the main command to build a bundled application. See Using PyInstaller .
- pyi-makespec is used to create a spec file. See Using Spec Files .
- pyi-archive_viewer is used to inspect a bundled application. See Inspecting Archives .
- pyi-bindepend is used to display dependencies of an executable. See Inspecting Executables .
- pyi-grab_version is used to extract a version resource from a Windows executable. See Capturing Windows Version Data .
- pyi-set_version can be used to apply previously-extracted version resource to an existing Windows executable.
© Copyright This document has been placed in the public domain.. Revision 90c9ac42 .
