diff options
| author | 2020-12-31 22:06:37 +0000 | |
|---|---|---|
| committer | 2020-12-31 22:06:37 +0000 | |
| commit | ecd9bd0eefe963fb61dbfdef9fe4fb61fdd85b94 (patch) | |
| tree | 60cc10a403f7be116d93e4f5464dde2efd5085a0 | |
| parent | Merge pull request #1334 from python-discord/bug/precommit-pycharm (diff) | |
First draft of env explaintions
| -rw-r--r-- | bot/resources/tags/enviroments.md | 18 |
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..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 |