Как скачать модуль в pycharm
Перейти к содержимому

Как скачать модуль в pycharm

  • автор:

Как скачать модуль в pycharm

Helen Scott

In the previous step, we set up a Python interpreter for our project. But sometimes our project depends on Python packages and getting those setup can be tricky.

Package Tool Window

In 2021, PyCharm added a new Packages tool window to help you see which Python packages are in your interpreter, as well as manage them. You can use this to see what packages PyCharm has installed, for example some will be installed if you select Flask as your project type such as the Jinja2 and Flask packages.

Python Packages

It’s important to mention that these packages belong to the current virtual environment that PyCharm also created for this project.

In this case, a virtual environment in this project directory, based on Python 3.10. You can see this information by clicking on the Status Bar.

View Python packages on the Status Bar

Add PyPI Package

You can also browse and install PyPi packages such as requests; a very popular Python package. In the Packages tool window you can type in requests and PyCharm will search the PyPi repository and return the most relevant packages that match your search.

If you click the package name, the PyPi documentation for this package is shown on the right-hand side. Not all minor packages have PyPi documentation so in some cases it will not be available.

To install the package, you can click Install which will use the latest stable version of the package. You don’t need to install it using the command line. You can also select a specific version to install if you need to.

Requests package

If you now check your list of installed packages, requests is there, ready to be imported and used in our scripts. You might also want to delete a package. In this case, you need to click the three dots and then select Delete package.

PyCharm can manage local or remote environments, pip vs. conda vs. pipenv vs. poetry, and more!

Add Repository Package

We’ve covered how to install packages from PyPi, but you might also want to install packages from a version control system like GitHub or from your local machine. In this case, you can click Add packages in the Package tool window and then you have two options:

Add repository packages

  • Add packages from version control
    • Select the version control system that you’re using and specify a path to the target repository.
  • Add packages from your local disk
    • You can provide the local path to your package directory or an archive.

In both cases, you can select the -e checkbox to install the package in editable mode.

Conclusion

You just saw how easy it is to install and manage Python packages in PyCharm. Another quick tip is that sometimes people install Python packages from the local terminal without having the virtual environment activated. In this case, when you import the package using PyCharm, you will see a red squiggly line and an error saying ‘No module named requests’, for example. You can prevent this kind of error by using PyCharm to install and upgrade your packages.

In the next step, we’ll see some basic code assistance tips that will boost your productivity in PyCharm.

Video

You can also check out the video for this step from our Getting Started series on YouTube:

Подключение модулей в PyCharm

Установил модуль requests для python через PIP . В терминале через интерпритатор python3 всё работает:

>>> import requests >>> r = requests.get('http://google.com') >>> print(r.text) 

А вот PyCharm не видит подключённого модуля с тем же кодом. Как дать ему знать, что он есть?
ОС: Ubuntu 18.04

Отслеживать
задан 14 янв 2019 в 15:02
722 2 2 золотых знака 8 8 серебряных знаков 22 22 бронзовых знака

2 ответа 2

Сортировка: Сброс на вариант по умолчанию

1) Для подключения модулей перейти в File->Settings->Interpreter
2) Находим значок «+»
3) Ищем нужный модуль, устанавливаем его. Подтверждаем изменения, перезагружаем с настройкой обнволений PyCharm
3) Profit

введите сюда описание изображения введите сюда описание изображения

Отслеживать
ответ дан 14 янв 2019 в 17:18
722 2 2 золотых знака 8 8 серебряных знаков 22 22 бронзовых знака

Спасибо огромное, полчаса сидел в раздумьях почему cmd всё видит и воспроизводит (модуль ставил через pip) а pycharm не в какую не хочет. Теперь всё работает.

20 мая 2019 в 10:30

ваш проект имеет своё виртуальное окружение venv. Туда ставятся все пакеты, что Вы хотели бы. Поэтому можно к тому варианту выше (что Вам посоветовали) так же прямо в Терминале самой IDE (а он уже будет запущен с Вашим виртуальным окружением) сделать установку необходимого пакета обычным для Вас способом:

(venv) xxxxx@yyyy:~/PycharmProjects/my_project$ pip . 

Все установленные пакеты таким образом так же будут отображены в Project Interpreter после установки из Терминала самого PyCharm с текущим виртуальным окружением Вашего проекта.

Как установить модуль requests в PyCharm?

61734812dafbe896703035.png

Делаю : File — setting — project interpreter — жму плюс — выбираю из списка requests и получаю ошибку:

Прошу подсказки уважаемых форумчан о том, как установить в PyCharm эту библиотеку. Спасибо

  • Вопрос задан более двух лет назад
  • 2220 просмотров

Комментировать

Решения вопроса 1

karabanov

Системный администратор

Так написано же в чём проблема. Просто переведи с английского и погугли про —build-dir
Найдёшь, например, PyCharm venv failed: ‘no such option: —build-dir’

Ответ написан более двух лет назад

Комментировать

Нравится 2 Комментировать

Как установить модули/пакеты в PyCharm?

5a0dddaa2f577522750306.png

У меня спокойно устанавливаются все базовые пакеты, но при установке любых других появляется такая ошибка:

ошибка

Collecting tmtoolkit Downloading tmtoolkit-0.1.6-py2.py3-none-any.whl (15.3MB) Collecting pandas (from tmtoolkit) Downloading pandas-0.21.0.tar.gz (11.3MB) Complete output from command python setup.py egg_info: Running from numpy source directory. C:\Users\5A86~1\AppData\Local\Temp\easy_install-bz49tq70\numpy-1.13.3\setup.py:367: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates run_build = parse_setuppy_commands() C:\Users\5A86~1\AppData\Local\Temp\easy_install-bz49tq70\numpy-1.13.3\numpy\distutils\system_info.py:572: UserWarning: Atlas (http://math-atlas.sourceforge.net/) libraries not found. Directories to search for the libraries can be specified in the numpy/distutils/site.cfg file (section [atlas]) or by setting the ATLAS environment variable. self.calc_info() C:\Users\5A86~1\AppData\Local\Temp\easy_install-bz49tq70\numpy-1.13.3\numpy\distutils\system_info.py:572: UserWarning: Blas (http://www.netlib.org/blas/) libraries not found. Directories to search for the libraries can be specified in the numpy/distutils/site.cfg file (section [blas]) or by setting the BLAS environment variable. self.calc_info() non-existing path in 'numpy\\distutils': 'site.cfg' C:\Users\5A86~1\AppData\Local\Temp\easy_install-bz49tq70\numpy-1.13.3\numpy\distutils\system_info.py:572: UserWarning: Lapack (http://www.netlib.org/lapack/) libraries not found. Directories to search for the libraries can be specified in the numpy/distutils/site.cfg file (section [lapack]) or by setting the LAPACK environment variable. self.calc_info() C:\Users\5A86~1\AppData\Local\Temp\easy_install-bz49tq70\numpy-1.13.3\numpy\distutils\system_info.py:572: UserWarning: Lapack (http://www.netlib.org/lapack/) sources not found. Directories to search for the sources can be specified in the numpy/distutils/site.cfg file (section [lapack_src]) or by setting the LAPACK_SRC environment variable. self.calc_info() C:\Python34\lib\distutils\dist.py:260: UserWarning: Unknown distribution option: 'define_macros' warnings.warn(msg) Traceback (most recent call last): File "C:\Python34\lib\distutils\core.py", line 148, in setup dist.run_commands() File "C:\Python34\lib\distutils\dist.py", line 955, in run_commands self.run_command(cmd) File "C:\Python34\lib\distutils\dist.py", line 974, in run_command cmd_obj.run() File "C:\Python34\lib\site-packages\setuptools\command\bdist_egg.py", line 161, in run self.run_command("egg_info") File "C:\Python34\lib\distutils\cmd.py", line 313, in run_command self.distribution.run_command(command) File "C:\Python34\lib\distutils\dist.py", line 974, in run_command cmd_obj.run() File "C:\Users\5A86~1\AppData\Local\Temp\easy_install-bz49tq70\numpy-1.13.3\numpy\distutils\command\egg_info.py", line 26, in run File "C:\Python34\lib\distutils\cmd.py", line 313, in run_command self.distribution.run_command(command) File "C:\Python34\lib\distutils\dist.py", line 974, in run_command cmd_obj.run() File "C:\Users\5A86~1\AppData\Local\Temp\easy_install-bz49tq70\numpy-1.13.3\numpy\distutils\command\build_src.py", line 148, in run File "C:\Users\5A86~1\AppData\Local\Temp\easy_install-bz49tq70\numpy-1.13.3\numpy\distutils\command\build_src.py", line 159, in build_sources File "C:\Users\5A86~1\AppData\Local\Temp\easy_install-bz49tq70\numpy-1.13.3\numpy\distutils\command\build_src.py", line 294, in build_library_sources File "C:\Users\5A86~1\AppData\Local\Temp\easy_install-bz49tq70\numpy-1.13.3\numpy\distutils\command\build_src.py", line 377, in generate_sources File "numpy\core\setup.py", line 672, in get_mathlib_info 'pandas.tests', File "C:\Python34\lib\distutils\command\config.py", line 243, in try_link self._check_compiler() File "C:\Users\5A86~1\AppData\Local\Temp\easy_install-bz49tq70\numpy-1.13.3\numpy\distutils\command\config.py", line 51, in _check_compiler File "C:\Users\5A86~1\AppData\Local\Temp\easy_install-bz49tq70\numpy-1.13.3\numpy\distutils\msvccompiler.py", line 50, in initialize File "C:\Python34\lib\distutils\msvc9compiler.py", line 371, in initialize vc_env = query_vcvarsall(VERSION, plat_spec) File "C:\Python34\lib\site-packages\setuptools\msvc.py", line 147, in msvc9_query_vcvarsall return EnvironmentInfo(arch, ver).return_env() File "C:\Python34\lib\site-packages\setuptools\msvc.py", line 1228, in return_env [self.VCIncludes, File "C:\Python34\lib\site-packages\setuptools\msvc.py", line 877, in VCIncludes return [os.path.join(self.si.VCInstallDir, 'Include'), File "C:\Python34\lib\site-packages\setuptools\msvc.py", line 556, in VCInstallDir raise distutils.errors.DistutilsPlatformError(msg) distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 10.0 is required. Get it with "Microsoft Windows SDK 7.1": www.microsoft.com/download/details.aspx?id=8279 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Python34\lib\site-packages\setuptools\sandbox.py", line 158, in save_modules yield saved File "C:\Python34\lib\site-packages\setuptools\sandbox.py", line 199, in setup_context yield File "C:\Python34\lib\site-packages\setuptools\sandbox.py", line 254, in run_setup _execfile(setup_script, ns) File "C:\Python34\lib\site-packages\setuptools\sandbox.py", line 49, in _execfile exec(code, globals, locals) File "C:\Users\5A86~1\AppData\Local\Temp\easy_install-bz49tq70\numpy-1.13.3\setup.py", line 392, in def build_extension(self, ext): File "C:\Users\5A86~1\AppData\Local\Temp\easy_install-bz49tq70\numpy-1.13.3\setup.py", line 384, in setup_package self.check_cython_extensions(self.extensions) File "C:\Users\5A86~1\AppData\Local\Temp\easy_install-bz49tq70\numpy-1.13.3\numpy\distutils\core.py", line 169, in setup File "C:\Python34\lib\site-packages\setuptools\__init__.py", line 129, in setup return distutils.core.setup(**attrs) File "C:\Python34\lib\distutils\core.py", line 163, in setup raise SystemExit("error: " + str(msg)) SystemExit: error: Microsoft Visual C++ 10.0 is required. Get it with "Microsoft Windows SDK 7.1": www.microsoft.com/download/details.aspx?id=8279 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Python34\lib\site-packages\setuptools\command\easy_install.py", line 1104, in run_setup run_setup(setup_script, args) File "C:\Python34\lib\site-packages\setuptools\sandbox.py", line 257, in run_setup raise File "C:\Python34\lib\contextlib.py", line 77, in __exit__ self.gen.throw(type, value, traceback) File "C:\Python34\lib\site-packages\setuptools\sandbox.py", line 199, in setup_context yield File "C:\Python34\lib\contextlib.py", line 77, in __exit__ self.gen.throw(type, value, traceback) File "C:\Python34\lib\site-packages\setuptools\sandbox.py", line 170, in save_modules saved_exc.resume() File "C:\Python34\lib\site-packages\setuptools\sandbox.py", line 145, in resume six.reraise(type, exc, self._tb) File "C:\Python34\lib\site-packages\pkg_resources\_vendor\six.py", line 685, in reraise raise value.with_traceback(tb) File "C:\Python34\lib\site-packages\setuptools\sandbox.py", line 158, in save_modules yield saved File "C:\Python34\lib\site-packages\setuptools\__init__.py", line 129, in setup return distutils.core.setup(**attrs) File "C:\Python34\lib\distutils\core.py", line 163, in setup raise SystemExit("error: " + str(msg)) SystemExit: error: Microsoft Visual C++ 10.0 is required. Get it with "Microsoft Windows SDK 7.1": www.microsoft.com/download/details.aspx?id=8279 ---------------------------------------- Command "python setup.py egg_info" failed with error code 1 in C:\Users\Блаблабла\AppData\Local\Temp\pycharm-packaging1\pandas\
  • Вопрос задан более трёх лет назад
  • 13079 просмотров

8 комментариев

Простой 8 комментариев

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *