Python is an easy to learn, powerful programming language. It has efficient high-level data structures and a simple but effective approach to object-oriented programming. Python’s elegant syntax and dynamic typing, together with its interpreted nature, make it an ideal language for scripting and rapid application development in many areas on most platforms.
pippip is the package installer for Python. Sometimes
piprefers to either
pip3. As Python 2 gets deprecated, hopefully it would not be ambiguous in the future.
Generally you don't need to worry about installation of pip itself. And here are the common commands with
# install package pip install packageName # latest version pip install packageName==1.0.0 # specific version pip install packageName>=2.0.0 # minimum version # install a list of requirements specified in a file pip install -r requirements.txt # update package pip install --upgrade [packageName] # remove package pip uninstall [packageName]
When working with multiple projects, you may encounter version conflict problem: some project requires a specific version of a package, while another project requires another version. Virtual environment helps to solve that issue: you can create different virtual environments for different projects.
Newer versions of Python comes with
venv, so it's handy to create virtual environment directly.
# create a virtual environment python3 -m venv tutorial-env # activate a virtual environment after creating one tutorial-env\Scripts\activate.bat # on Windows source tutorial-env/bin/activate # on Unix or MacOS # deactivate the virtual environment after activating deactivate
Here is the documentation of
Anaconda makes it easier to manage packages and environments. Anaconda® is a package manager, an environment manager, a Python/R data science distribution, and a collection of over 7,500+ open-source packages. Anaconda is free and easy to install, and it offers free community support. You can download it free.
Personally, I'd recommend using Anaconda because:
- it includes almost all packages you need, you don't have to install them manually
- it protects your system environment, especially if you are using macOS
Python plays an important role in data science. It is worth of another page to discuss data science. Here I'll just list some of the packages related to data science.
Data and computing