From f1961a0c7c581d74e654fb7a24938f35f7be786e Mon Sep 17 00:00:00 2001 From: discretegames Date: Mon, 7 Nov 2022 16:10:46 -0800 Subject: reorg of windows guides, moved py launcher into installing and using, fixed links --- .../guides/python-guides/windows/common-issues.md | 15 ++-- .../windows/installing-and-using-python.md | 87 ++++++++++++++++++++++ .../python-guides/windows/installing-python.md | 71 ------------------ .../python-guides/windows/microsoft-store.md | 4 +- .../windows/putting-python-on-path.md | 4 +- .../guides/python-guides/windows/py-launcher.md | 50 ------------- .../python-guides/windows/unix-env-on-windows.md | 4 +- 7 files changed, 101 insertions(+), 134 deletions(-) create mode 100644 pydis_site/apps/content/resources/guides/python-guides/windows/installing-and-using-python.md delete mode 100644 pydis_site/apps/content/resources/guides/python-guides/windows/installing-python.md delete mode 100644 pydis_site/apps/content/resources/guides/python-guides/windows/py-launcher.md (limited to 'pydis_site') 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-and-using-python.md b/pydis_site/apps/content/resources/guides/python-guides/windows/installing-and-using-python.md new file mode 100644 index 00000000..6eb87b86 --- /dev/null +++ b/pydis_site/apps/content/resources/guides/python-guides/windows/installing-and-using-python.md @@ -0,0 +1,87 @@ +--- +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 +--- + + + +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 +issues](../microsoft-store). + +On [python.org/downloads](https://python.org/downloads), click the big yellow "Download Python 3.x.x" button near the top of the page and it should automatically start a download of the installer for the latest stable version of Python +that best suits your computer. + +## Selecting an Installer + +There are many different installer options available from the downloads page. +You should usually select the "Windows installer" option instead of the "Windows +embeddable package". Some minor versions may not + +### Which version? + +Current Python versions follow the form `3.minor.micro`. Major releases happen +yearly and provide new features and breaking changes, whilst minor releases are +more common and only include bug/security fixes. + +Installing the latest major version will give you access to Python's newest +features. However, some modules may not support the newest versions straight +away, so installing the second latest will help you avoid those issues. If you +find you want some newer features or your module does not support your current +version, you can always install another version as well. + +You should generally always install the newest minor version, although some may +not provide an installer in which case you should find the newest that does. + +### 32-bit vs 64-bit? + +Install 64-bit python unless you have reason not to. With 32 bit you may run +into memory limits if doing intensive operations (Python will be limited to +using 4GB of memory), and some installed modules may not offer prebuilt wheels +for 32 bit, potentially making installs slower or meaning you have to install +build dependencies. + +If you get an error when installing 64-bit Python, your computer may not support +it. To find out if this is the case, search "About your PC" in windows search +and open the settings page. Then look for the "System Type" option under "Device +Specifications". It should say "64-bit operating system, x64-based processor" if +you have support. You need a 64 bit processor and OS to install 64 bit programs. + +## Running the installer + +When you run the installer you should see a screen like this: + +![python_installer_screen](https://user-images.githubusercontent.com/22353562/126144479-cfe6bd98-6d2e-47c3-b6b3-5de9f2656e9a.png) + +Make sure you tick "Add Python 3.x to Path". This allows you to use the `python` +and `pip` commands in your terminal to invoke Python. If you already have a +Python installation on your PATH and don't want this one to override it, don't +tick this. + +If you installed Python without adding to PATH and now want to add it, see +[our guide on adding Python to PATH](../putting-python-on-path). + +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](../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/installing-python.md b/pydis_site/apps/content/resources/guides/python-guides/windows/installing-python.md deleted file mode 100644 index e262d287..00000000 --- a/pydis_site/apps/content/resources/guides/python-guides/windows/installing-python.md +++ /dev/null @@ -1,71 +0,0 @@ ---- -title: Installing Python on Windows -description: How we recommend installing Python on Windows -icon: fab fa-windows ---- - -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 -issues](../microsoft-store). - -On [python.org/downloads](https://python.org/downloads), click the big yellow "Download Python 3.x.x" button near the top of the page and it should automatically start a download of the installer for the latest stable version of Python -that best suits your computer. - -## Selecting an Installer - -There are many different installer options available from the downloads page. -You should usually select the "Windows installer" option instead of the "Windows -embeddable package". Some minor versions may not - -### Which version? - -Current Python versions follow the form `3.minor.micro`. Major releases happen -yearly and provide new features and breaking changes, whilst minor releases are -more common and only include bug/security fixes. - -Installing the latest major version will give you access to Python's newest -features. However, some modules may not support the newest versions straight -away, so installing the second latest will help you avoid those issues. If you -find you want some newer features or your module does not support your current -version, you can always install another version as well. - -You should generally always install the newest minor version, although some may -not provide an installer in which case you should find the newest that does. - -### 32-bit vs 64-bit? - -Install 64-bit python unless you have reason not to. With 32 bit you may run -into memory limits if doing intensive operations (Python will be limited to -using 4GB of memory), and some installed modules may not offer prebuilt wheels -for 32 bit, potentially making installs slower or meaning you have to install -build dependencies. - -If you get an error when installing 64-bit Python, your computer may not support -it. To find out if this is the case, search "About your PC" in windows search -and open the settings page. Then look for the "System Type" option under "Device -Specifications". It should say "64-bit operating system, x64-based processor" if -you have support. You need a 64 bit processor and OS to install 64 bit programs. - -## Running the installer - -When you run the installer you should see a screen like this: - -![python_installer_screen](https://user-images.githubusercontent.com/22353562/126144479-cfe6bd98-6d2e-47c3-b6b3-5de9f2656e9a.png) - -Make sure you tick "Add Python 3.x to Path". This allows you to use the `python` -and `pip` commands in your terminal to invoke Python. If you already have a -Python installation on your PATH and don't want this one to override it, don't -tick this. - -If you installed Python without adding to PATH and now want to add it, see -[our guide on adding Python to PATH](../putting-python-on-path). - -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). 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 ---- - - - -## 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 -- cgit v1.2.3