diff options
author | 2022-11-07 16:10:46 -0800 | |
---|---|---|
committer | 2022-11-07 16:10:46 -0800 | |
commit | f1961a0c7c581d74e654fb7a24938f35f7be786e (patch) | |
tree | 0e013d6e13df669700dbe9e86614c33c7975d4c9 | |
parent | tweaks and link fixes to windows guides, still in reorg process (diff) |
reorg of windows guides, moved py launcher into installing and using, fixed links
-rw-r--r-- | pydis_site/apps/content/resources/guides/python-guides/windows/common-issues.md | 15 | ||||
-rw-r--r-- | pydis_site/apps/content/resources/guides/python-guides/windows/installing-and-using-python.md (renamed from pydis_site/apps/content/resources/guides/python-guides/windows/installing-python.md) | 32 | ||||
-rw-r--r-- | pydis_site/apps/content/resources/guides/python-guides/windows/microsoft-store.md | 4 | ||||
-rw-r--r-- | pydis_site/apps/content/resources/guides/python-guides/windows/putting-python-on-path.md | 4 | ||||
-rw-r--r-- | pydis_site/apps/content/resources/guides/python-guides/windows/py-launcher.md | 50 | ||||
-rw-r--r-- | pydis_site/apps/content/resources/guides/python-guides/windows/unix-env-on-windows.md | 4 |
6 files changed, 38 insertions, 71 deletions
diff --git a/pydis_site/apps/content/resources/guides/python-guides/windows/common-issues.md b/pydis_site/apps/content/resources/guides/python-guides/windows/common-issues.md index 4d8530d5..dcf94f73 100644 --- a/pydis_site/apps/content/resources/guides/python-guides/windows/common-issues.md +++ b/pydis_site/apps/content/resources/guides/python-guides/windows/common-issues.md @@ -1,5 +1,5 @@ --- -title: Common issues using Python on Windows +title: Common Issues Using Python on Windows description: A list of common issues with Python on Windows and how to fix them icon: fab fa-windows --- @@ -19,12 +19,12 @@ If after doing this you have an issue with the Python command not being detected ### When I try and run my code with `python` in the terminal I get an error saying the command was not recognized -If you have not installed Python, you will need to do that. Follow our guide [here](../installing-python). +If you have not installed Python, you will need to do that. Follow our guide [here](../installing-and-using-python). If you have installed python and are still having the issue, it is likely that you didn't check the "Add python.exe to -PATH" checkbox on the first page of the installer. See [our guide on adding Python to -PATH](../putting-python-on-path) for how to fix this. You can also use the `py` launcher instead of `python` by just -replacing `python` in your command with `py`. See [this guide](../py-launcher) for more information on that. +PATH" checkbox on the first page of the installer. See [our guide on adding Python to PATH](../putting-python-on-path) +for how to fix this. You can also use the `py` launcher instead of `python` by just replacing `python` in your command +with `py`. See [this guide](../installing-and-using-python/#the-py-launcher) for more information on that. ### I `pip` installed a package but when running my code get a `ModuleNotFoundError` @@ -36,7 +36,8 @@ replacing `python` in your command with `py`. See [this guide](../py-launcher) f If your code runs fine, you could try restarting your editor. If you have newly installed a module it may just not have detected it yet. If that doesn't help, you may need to configure your editor to ensure it is looking for the - module in the correct Python environment. See [our guide on virtual environments](dg:TODO) for more information. + module in the correct Python environment. See [our guide on virtual + environments](../installing-and-using-python/#virtual-environments) for more information. - #### Was the install successful? @@ -126,7 +127,7 @@ common causes for this are: `PythonSoftwareFoundation.Python.3.10_3.10.2288.0_x64__qbz5n2kfra8p0`, you are using Python from the Microsoft Store. To fix this you will either have to use the full path to the scripts you want to use, or [uninstall the Microsoft Store Python](/static/images/content/python-on-windows/ms_store_uninstall.png) and [install Python - properly](../installing-python) with a [python.org installer](https://www.python.org/downloads). + properly](../installing-and-using-python) with a [python.org installer](https://www.python.org/downloads). - You manually modified your PATH Environment Variable incorrectly diff --git a/pydis_site/apps/content/resources/guides/python-guides/windows/installing-python.md b/pydis_site/apps/content/resources/guides/python-guides/windows/installing-and-using-python.md index e262d287..6eb87b86 100644 --- a/pydis_site/apps/content/resources/guides/python-guides/windows/installing-python.md +++ b/pydis_site/apps/content/resources/guides/python-guides/windows/installing-and-using-python.md @@ -1,9 +1,19 @@ --- -title: Installing Python on Windows -description: How we recommend installing Python on Windows +title: Installing and Using Python on Windows +description: How we recommend installing Python on Windows, and how to use Python Windows features icon: fab fa-windows --- +<!-- dg:TODO reorg with + +- intro +- basic install +- advanced install +- py launcher info +- venvs + + --> + Our recommended way of installing Python on Windows is using a full installer from the official [python.org Downloads page](https://www.python.org/downloads/). Installing Python from the [Microsoft Store](https://apps.microsoft.com/store/search/python) is _not_ recommended as [it can cause various @@ -63,9 +73,15 @@ If you installed Python without adding to PATH and now want to add it, see Then simply click install, and wait for the install to finish! -To test your installation, type "cmd" in the windows search bar and select -"Command Prompt" to open a terminal (make sure it's opened _after_ installation -has finished) type `python -V`, and press enter. If it outputs your python -version, you've successfully installed Python. (if you didn't add to PATH, you -can use [the py launcher](../py-launcher) to test -instead). +To test your installation, type "cmd" in the windows search bar and select "Command Prompt" to open a terminal (make +sure it's opened _after_ installation has finished) type `python -V`, and press enter. If it outputs your python +version, you've successfully installed Python. (if you didn't add to PATH, you can use [the py +launcher](../installing-and-using-python/#the-py-launcher) to test instead). + +## The py Launcher + +dg:TODO + +## Virtual Environments + +dg:TODO diff --git a/pydis_site/apps/content/resources/guides/python-guides/windows/microsoft-store.md b/pydis_site/apps/content/resources/guides/python-guides/windows/microsoft-store.md index e77fe963..9620c09f 100644 --- a/pydis_site/apps/content/resources/guides/python-guides/windows/microsoft-store.md +++ b/pydis_site/apps/content/resources/guides/python-guides/windows/microsoft-store.md @@ -1,5 +1,5 @@ --- -title: Why not to install Python from the Microsoft Store +title: Why Not to Install Python from the Microsoft Store description: The drawbacks of installing the Microsoft Store versions of Python icon: fab fa-windows --- @@ -12,7 +12,7 @@ Store](https://apps.microsoft.com/store/search/python) as an alternative to usin python.org](https://www.python.org/downloads). **We recommend you install Python on Windows using the [full installer from python.org](https://www.python.org/downloads), and not from the Microsoft store wherever possible!** -You can follow [this guide to install Python from python.org](../installing-python) and more Python Windows releases +You can follow [this guide to install Python from python.org](../installing-and-using-python) and more Python Windows releases can be found [here](https://www.python.org/downloads/windows). Here are some common issues with using Python from the Microsoft Store: diff --git a/pydis_site/apps/content/resources/guides/python-guides/windows/putting-python-on-path.md b/pydis_site/apps/content/resources/guides/python-guides/windows/putting-python-on-path.md index fc921623..5543ee16 100644 --- a/pydis_site/apps/content/resources/guides/python-guides/windows/putting-python-on-path.md +++ b/pydis_site/apps/content/resources/guides/python-guides/windows/putting-python-on-path.md @@ -6,7 +6,7 @@ toc: 2 --- If you're on Windows and know you have [Python installed from python.org](https://www.python.org/downloads/) ([our -recommended way](../installing-python)) but you're still getting errors like +recommended way](../installing-and-using-python)) but you're still getting errors like ```text pip : The term 'pip' is not recognized as the name of a cmdlet, function, script file, or operable program. @@ -97,7 +97,7 @@ can see where that terminal is finding the `python.exe` it would run when a `pyt alias](../microsoft-store#confusing-app-execution-alias-behaviour) one that opens the Microsoft Store.) You can also run Python with `python` (not `py` as that may start a different version, see more -[here](.../py-launcher)), and then after `>>>` in the Python REPL, run +[here](../installing-and-using-python/#the-py-launcher)), and then after `>>>` in the Python REPL, run ```py import sys; print(sys.executable); exit(); diff --git a/pydis_site/apps/content/resources/guides/python-guides/windows/py-launcher.md b/pydis_site/apps/content/resources/guides/python-guides/windows/py-launcher.md deleted file mode 100644 index 99d6deda..00000000 --- a/pydis_site/apps/content/resources/guides/python-guides/windows/py-launcher.md +++ /dev/null @@ -1,50 +0,0 @@ ---- -title: The py Launcher -description: Common commands and usage of the "py" Python launcher on Windows -icon: fab fa-windows ---- - -<!-- dg:TODO rewrite/rearrange to be all about the py command --> - -## The py launcher - -By default, Python installed on Windows using the online Python installer comes -with the "py launcher". It is a command line tool you invoke using the `py` -command, and helps you invoke a specific python version. - -It provides the `py -0p` command. This lists the python versions you have -installed, the output will look like this: - - C:\Users\username>py -0p - Installed Pythons found by py Launcher for Windows - -V:3.11 C:\Users\username\AppData\Local\Programs\Python\Python311\python.exe - -V:3.10 C:\Users\username\AppData\Local\Programs\Python\Python310\python.exe - -V:3.9 * C:\Users\username\AppData\Local\Programs\Python\Python39\python.exe - -The versions will be ordered from newest to oldest, and the `*` will indicate -which version running `py` will call by default. This depends on the following -requirements, and may not be the same version you get from running `python` (if -you get any): - -```text -If an exact version is not given, using the latest version can be overridden by -any of the following, (in priority order): -• An active virtual environment -• A shebang line in the script (if present) -• With -2 or -3 flag a matching PY_PYTHON2 or PY_PYTHON3 Environment variable -• A PY_PYTHON Environment variable -• From [defaults] in py.ini in your %LOCALAPPDATA%\py.ini -• From [defaults] in py.ini beside py.exe (use `where py` to locate) -``` - -You can override which version is called by specifying the major and minor -versions to used. For example, to invoke python 3.7, you could run `py -3.7`. -You can then pass any arguments to `python` on top of that, for example -`py -3.7 myscript.py` to run `myscript.py`, or `py -3.7 -m pip install numpy` -to invoke `pip` to install numpy into that version. - -You can use `py` instead of `python` and not have any python versions on PATH at -all. I would recommend having your "main" python version on path so you can -invoke it with `python` if you want to, and then use `py` whenever you want a -different version. The full documentation of the `py launcher` can be found -[here](https://docs.python.org/3/using/windows.html#python-launcher-for-windows) diff --git a/pydis_site/apps/content/resources/guides/python-guides/windows/unix-env-on-windows.md b/pydis_site/apps/content/resources/guides/python-guides/windows/unix-env-on-windows.md index d959d1f6..47f2138e 100644 --- a/pydis_site/apps/content/resources/guides/python-guides/windows/unix-env-on-windows.md +++ b/pydis_site/apps/content/resources/guides/python-guides/windows/unix-env-on-windows.md @@ -1,5 +1,5 @@ --- -title: Setting up a Unix-style Python Environment on Windows +title: Setting up a Unix-Style Python Environment on Windows description: How to setup a Unix-style Python environment ready to start coding in icon: fab fa-windows --- @@ -15,7 +15,7 @@ command prompt called Git Bash, which will support many of the commands availabl ## Installing Python First you'll need to install Python. We recommend installing from the Python website, you can follow our guide on how to -do this [here](../installing-python). +do this [here](../installing-and-using-python). ## Installing a text editor |