aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Chris <[email protected]>2020-12-31 22:06:37 +0000
committerGravatar Chris <[email protected]>2020-12-31 22:37:59 +0000
commit70fcbd1cdb742ff33ea6491b383bf2e65fe1b24f (patch)
treea57ad5d63099ce15400702b758e3acb67e18ca86
parentMerge pull request #1334 from python-discord/bug/precommit-pycharm (diff)
First draft of env explaintions
-rw-r--r--bot/resources/tags/enviroments.md18
1 files changed, 18 insertions, 0 deletions
diff --git a/bot/resources/tags/enviroments.md b/bot/resources/tags/enviroments.md
new file mode 100644
index 000000000..5b2914cd9
--- /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)