M
M
Maxim2016-06-29 21:51:56
Python
Maxim, 2016-06-29 21:51:56

How to properly install and then import (connect) modules in Python and in particular in PyCharm?

Hello!
Please tell me how to properly install and then import (connect) modules in Python and in particular in PyCharm.
As far as I understand modules should be installed in C:\Python34\Lib\site-packages or not necessarily so. After all, the same tkinter is located by default in C:\Python34\Lib\tkinter.
Is this entry "from tkinter import *" everything that is in tkinter imported? Including colorchooser?
or if I need "colorchooser" from "tkinter" which is in C:\Python34\Lib\tkinter, then we write:
"from tkinter import colorchooser" ? and then "from colorchooser import askcolor"?
PyCharm (Python) swears at me for this.
Or installed the "livewires" module C:
color.py and games.py are also there.
I am writing: from livewires import games, color
PyCharm (Python) swears at games, color
I will be glad to explain with examples of the correct code, or a link to a good lesson, preferably in Russian.
I'm a beginner, and most likely everything is very simple ... But I would like to understand for the future how to properly install modules and then connect them and extract the necessary functions.
System: WIN/Python 3
Thank you.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
T
tema_sun, 2016-06-30
@Animaxwell

Definitely not worth doing from module import *. Even temporarily during development - then you will forget and so it will remain there.
As for import and from-import, then it is worth navigating according to the situation.
For example, I will do from collections import OrderedDictand will then use just OrderedDict (), but in the case of livewires it will be more appropriate

import livewires 
# и далее
livewires.games
livewires.color

D
Dimonchik, 2016-06-29
@dimonchik2013

through settings
NOT EVERYTHING in win , and in Linux you can install from Paycharm, something through pip directly

R
Ranwise, 2016-06-29
@Ranwise

in the PyCharm settings you specify the version of Python, PyCharm itself picks up all the standard and installed packages, in the same place in the settings you can see the package versions and install / update

S
sim3x, 2016-06-29
@sim3x

learnpythonthehardway.org/book

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question