From ecd9bd0eefe963fb61dbfdef9fe4fb61fdd85b94 Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 31 Dec 2020 22:06:37 +0000 Subject: First draft of env explaintions --- bot/resources/tags/enviroments.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 bot/resources/tags/enviroments.md diff --git a/bot/resources/tags/enviroments.md b/bot/resources/tags/enviroments.md new file mode 100644 index 000000000..c4356254e --- /dev/null +++ b/bot/resources/tags/enviroments.md @@ -0,0 +1,18 @@ +**Python Enviroments** + +The main purpose of Python [virtual environments](https://docs.python.org/3/library/venv.html#venv-def) is to create an isolated environment for Python projects. This means that each project can have its own dependencies, such as third party packages installed using `pip`, regardless of what dependencies every other project has. + +To see the current enviroment in use by python you can run: +```py +>>> import sys +>>> print(sys.executable) +/usr/bin/python3 +``` + +To see the enviroment in use by `pip` you can do `pip debug`, or `pip3 debug` for linux/macOS. The 3rd line of the output will contain the path in use. I.E. `sys.executable: /usr/bin/python3` + +If the python's `sys.executable` doesn't match pip's then they are currently using different enviroments! This may cause python to raise a `ModuleNotFoundError` when you try to use a package you just installed with pip, as it was installed to a different enviroment. + +Further reading: +• [Real Python's primer on Python Virtual Environments](https://realpython.com/python-virtual-environments-a-primer) +• [pyenv: Simple Python Version Management](https://github.com/pyenv/pyenv) \ No newline at end of file -- cgit v1.2.3