Mac shows sudo: pip: command not found
After installing the pip module on the mac, using the pip command will prompt sudo: pip: command not found
moyanzhudeMacBook-Pro:~ oosmart$ sudo pip install pymysql sudo: pip: command not found
command not found, it means that the system does not find the module, the module may not be installed in the system, or the environment variable may not be set.
Install the module
If you install this module, you can skip this step
You need to go to the official website to download the mac version of pip corresponding to Python, and then install it according to the default path.
Configure environment variables or run directly
You can configure environment variables and then use the pip command
Or directly enter the bin directory to execute the pip method
#Enter python's bin directory moyanzhudeMacBook-Pro:~ moyan$ cd /Library/Frameworks/Python.framework/Versions/3.6/bin/ #redundant validation moyanzhudeMacBook- Pro:bin moyan$ ls 2to3 pydoc3 python3.6-config 2to3 -3.6 pydoc3.6 python3.6m easy_install-3.6 python3 python3.6m-config idle3 python3-32 pyvenv idle3. 6 python3-config pyvenv-3.6 pip3 python3. 6 pip3. 6 python3.6-32 #redundant test moyanzhudeMacBook- Pro :bin moyan$ pwd /Library/Frameworks/Python.framework/Versions/3.6/ bin #Execute the following command: moyanzhudeMacBook-Pro:bin moyan$ ./ pip3 install pymysql Collecting pymysql Downloading https://files.pythonhosted.org/packages/32/e8/222d9e1c7821f935d9f93a84f0b98afc219/PyMySQL-0.8.1-py2.py3-none-any.whl (81kB) 100% |████████████████████████████████| 81kB 295kB/s Installing collected packages: pymysql Successfully installed pymysql-0.8.1 You are using pip version 9.0.1, however version 10.0.1 is available. You should consider upgrading via the 'pip install --upgrade pip' command. #When this sentence appears, the installation is successful . Successfully installed pymysql -0.8.1
Encounter problems
When installing, you may encounter a version mismatch problem, you need to reinstall the Python version
Could not find a version that satisfies the requirement pymysql (from versions: ) No matching distribution found for pymysql