Before we start with how to install pip for Python on macOS, let’s first go through the basic introduction to Python. Show Python is a widely-used general-purpose, high-level programming language. Python is a programming language that lets you work quickly and integrate systems more efficiently. PIP is a package management system used to install and manage software packages/libraries written in Python. These files are stored in a large “on-line repository” termed as Python Package Index (PyPI). pip uses PyPI as the default source for packages and their dependencies. In this article, we will see How to Install PIP on a Mac. Using pip you can install any package using the following syntax: Syntax of pippip install package_name Download and Install Pip on macOSpip can be downloaded and installed usingthe command line by going through the following steps: Step 1: Download the get-pip.py(https://bootstrap.pypa.io/get-pip.py) file and store it in the same directory as python is installed. or Use the following command to download pip directly curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py Step 2: Now execute the downloaded file using the below command python3 get-pip.py Step 3: Wait through the installation process.
Voila! pip is now installed on your system. Verification of the Installation processOne can easily verify if the pip has been installed correctly by performing a version check on the same. Just go to the command line and execute the following command: pip3 --version pip --version
How to Update PIP on a MacYou can use the following command in your terminal to upgrade your pip. python3 -m pip install –upgrade pip How to install a specific version of pipTo install a specific version you can enter the following version number to install the specific version. Installing a separate copy of Python is a popular option, even though Python already comes with macOS. You take on the responsibility to make sure you're using the copy of Python you intend. But, the benefits are having the latest Python release and some protection from hosing your system if things go badly wrong. To install Python using HomeBrew:
Now confirm that we're working with our newly installed Python:
...should show a symbolic link to a path with "Cellar" in it like:
Pip should be installed along with Python. You might want to upgrade it by typing:
Now you're ready to install any of the 50,000+ packages on PyPI. Other NotesFormerly, I've used get-pip.py to install pip. But, the docs warn that get-pip.py does not coordinate with package managers and may leave your system in an inconsistent state. Anyway, there's no need, given that pip is now included with Python as of 2.7.9. Note that pip isn't the only package manager for Python. There's also easy_install. It's no good to mix the two, so don't do it. Finally, if you have both Python 2 and 3 installed, pip will point to whichever Python you installed last. Get in the habit of explicitly using either pip2 or pip3, so you're sure which Python is getting the new library. 总结一下自己在安装python时候遇到的问题 环境说明 macOS Catalina 版本10.15.7 安装python廖大大的python教程里说明如下:
安装pip官方地址 需要先download 该步骤中要使用命令
解决方案将 我在看到别人对该问题的解答的时候不明觉厉,这个文件是啥?在哪里? 这篇文章写的很详细Mac 打开、编辑 .bash_profile 文件 总结
|