![]() ![]() OK, so as long as you remember where you installed Python 3.7 and 3.8 and that it was different directories you will know which version of pip comes first on PATH. is /usr/bin before or after /usr/local/bin (which are common locations for Python to be installed into, and typically /usr/local/ comes first). First you would have to know what my PATH is set to, e.g. Without more details the answer is you don't know. Now, if you were to type pip in your terminal, which Python interpreter would it install for? Let's say I have two versions of Python installed, like Python 3.7 and 3.8 (and this is very common for people thanks to Python coming installed on macOS and Linux, let alone you may have installed Python 3.8 to play with it while having previously installed Python 3.7). So you might be saying, "OK, but can't I just run pip by executing the pip command?" And the answer is "yes, but with a lot less control", and I will explain what I mean by "less control" with an example. You can read the docs on -m if you're unfamiliar with the flag and how it works (it's very handy). So /usr/bin/python3.7 -m pip means you are executing pip for your interpreter located at /usr/bin/python3.7. To begin with, python -m pip executes pip using the Python interpreter you specified as python. So this blog post is meant to explain what python -m pip is and why you should be using it when you run pip. Now I'm not sure if it was specifically me that told Mariatta about python -m pip, but the chances are reasonable that it was me as I have been asking for it to become the instructions provided on PyPI on how to install a package since 2016. Likely from or any of you have a talk/blog post on this, so I can share with people?- Mariatta □ October 29, 2019 ![]() ` but now I can't remember the source of this information. I learned sometime ago that we should be doing ![]() ![]() Fellow core developer and Canadian, Mariatta, asked on Twitter about python -m pip and who told her about that idiom along with asking for a reference explaining it: ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |