Getting started with python
Some configuration (my OS is Ubuntu 16.04):
sudo apt-get install python-pip
Install pylint
pip install pylint
Config vscode settings
In settings.json
add
{
"python.linting.pylintPath": "~/.local/bin/pylint"
}
Install autopep8
pip install pep8
pip install --upgrade autopep8
Config vscode settings
In settings.json
add
{
"python.formatting.autopep8Path": "~/.local/bin/autopep8"
}
sudo apt-get update
sudo apt-get -y install python3-pip
pip3 --version
virtualenv
is virtual environment for python interpreter. It's useful for privacy project python, not use as global on your system.
pip install virtualenv
- Create Virtual Environment
In
~/
, create new virtual environment python by:
virtualenv python-virtualenv
or use following line to use with python3
virtualenv -p python3 python-virtualenv
It will create new folder python-virtualenv
(you can use other name).
- Activate and Deactivate virtualenv In terminal:
source ~/python-virtualenv/bin/activate
It will config python run from here To deactivate, run:
deactivate
- VS Code settings
Change
pythonPath
andlinting/pylintPath
with path virtualenv.
{
"python.pythonPath": "~/python-virtualenv/bin/python3.5",
"python.linting.pylintPath": "~/python-virtualenv/bin/pylint",
}
Syntax
pip install [name_package]
Packages:
- requests
- numpy
- matplotlib
- sympy
- scipy
- scikit-learn