Mac 显示sudo: pip: command not found

Mac显示sudo: pip: command not found

mac在安装完pip模块后,使用pip命令会提示sudo: pip: command not found

moyanzhudeMacBook-Pro:~ oosmart$ sudo pip install pymysql
sudo: pip: command not found

command not found,表示系统没有找到该模块,可能是系统没有安装该模块,也可能没有设置环境变量。

安装模块

如果安装该模块,可以跳过该步骤哦

需要去官网下载和Python相对应的pip的mac版本,然后按照默认路径安装即可。

配置环境变量或者直接运行

可以配置环境变量,然后使用pip命令

或者直接进入bin目录执行pip方法

#进入python的bin目录
moyanzhudeMacBook-Pro:~ moyan$ cd /Library/Frameworks/Python.framework/Versions/3.6/bin/ #多余效验
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
#多余效验
moyanzhudeMacBook-Pro:bin moyan$ pwd
/Library/Frameworks/Python.framework/Versions/3.6/bin #执行下面命令即可:
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. #出现这句话即安装成功
Successfully installed pymysql-0.8.1

遇到问题

安装的时候可能会遇到版本不匹配的问题,需要重新安装Python版本

Could not find a version that satisfies the requirement pymysql (from versions: )
No matching distribution found for pymysql
上一篇:DEDECMS织梦自定义表单中必填项、电话邮箱过滤以及验证码规则


下一篇:UIImage两种初始化的区别