当前位置:   article > 正文

Mac 显示sudo: pip: command not found

mac电脑pip3安装的包 -bash 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

 

转载于:https://www.cnblogs.com/moyand/p/9010566.html

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/繁依Fanyi0/article/detail/793213
推荐阅读
相关标签
  

闽ICP备14008679号