简体   繁体   中英

Where is PIP installed by default with Python 3.7 for Mac?

I am new to Python and looking to use to to create some cool solutions. The documentation says that pip is included by default with Python 3.4+ and I've just installed version 3.7.3 but cannot located pip as I was attempting to use it to install the Requests package for API calls.

$ python3 --version
Python 3.7.3
$ pip --version
-bash: pip: command not found

So I can see in fact that version 3.7.3 of Python is installed, yet pip isn't? I checked both Library/Python/3.7/bin/ and Library/Python/3.7/lib/python/site-packages/ and do not see any reference to pip.

The documentation states that you can use a curl command to get pip and then install it. I am new to the terminal and have never used a curl command. Also, I've read you want to keep your Python3 stuff away from the system Python version, so would I use the following?

$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
$ python3 get-pip.py

您需要使用python3 -m pip .....来表明您正在使用Python 3,否则它将使用默认的Python 2

The following worked for me:

$ which pip3.7

which returned

/Library/Frameworks/Python.framework/Versions/3.7/bin/pip3.7

The purpose of my question was to find out if pip was installed so i could use it to get another package. It was, so I ended up doing the following with success.

$ pip3.7 install requests

which returned

Installing collected packages: idna, urllib3, chardet, certifi, requests
Successfully installed certifi-2019.3.9 chardet-3.0.4 idna-2.8 requests-2.22.0 urllib3-1.25.3

I'd imagine that since I only installed Python3.7 on my mac and since pip3.7 was included, i could have likely input pip3 install requests although I am not sure if there were other versions of pip installed prior what would happen, maybe someone could clarify in comments about the nuances.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM