See Digital Ocean's quick guide to [https://www.digitalocean.com/community/tutorials/how-to-install-python-3-and-set-up-a-local-programming-environment-on-ubuntu-16-04 setting up a local Python programming environment], including [https://virtualenv.pypa.io/en/stable/ virtual environments], which is what I did for [https://github.com/Miserlou/SoundScrape SoundScrape] Btw, SoundScrape is a neat tool to download sound files from SoundCloud. <ref><source lang="bash">cdmkdir environmentscd environments/pyvenv my_envsource my_env/bin/activatepip install --upgrade pippip install soundscrapepip install soundscrape --upgradesoundscrape https://soundcloud.com/pianoman_weddings/coldplay</source></ref> Hynek Schlawack(from 2013)
* [https://hynek.me/talks/python-deployments/ Notes]
* [https://www.youtube.com/watch?v=RvbDCzroavY Video]
== Python Packaging ==
Christoph Haas discusses virtualenv, easy_installIn the old days (2015) there were still debates about how to package Python and install stuff. Now, it's settled. Use pip, apt/yum. Easy_install is dead. See the [https://workarounddocs.python.org/easy3/installing/index.html docs]. Also note that <code>venv</code> is the successor to <code>virtualenv</code> == Basic PIP ==Do NOT (normally) use sudo with pip. Use a virtual environment:<source lang="bash">$ virtualenv myenv.. some output ..$ source myenv/bin/activate(myenv) $ pip install what-i-want</source>You only use sudo or elevated permissions when you want to installstuff for the global, system-debianwide Python installation.
Stackoverflow says [http://stackoverflowIt is best to use a virtual environment which isolates packages for you.com/questions/3220404/why-use-pip-over-easy-That way you can play around without polluting the global python install/ use pip over easy_install], but things have been changing over the past few years, so the future/best practice may require a bit more digging.
== Basic PIP ==pip is As a fast-moving target and the packaged versions in Debian or Ubuntu are old and buggy. Sobonus, you should get pip from upstreamvirtualenv does not need elevated permissions.
* Installing a package is as simple as <code>sudo pip install foo</code>* Upgrades are <code>sudo pip install --upgrade foo</code> * <code>sudo pip uninstall foo</code> if you want to remove foo<ref>but you might have to resort to brute force like <code>sudo rm -rf /usr/local/lib/python2.7/dist-packages/dopy*</code> since old pip is buggy. Or try without sudo. Or just upgrade pip</ref>
{{References}}