博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
pip: command not found 一系列报错
阅读量:6524 次
发布时间:2019-06-24

本文共 3621 字,大约阅读时间需要 12 分钟。

#安装python2.7版本

tar xvf Python-2.7.9.tar.xzcd Python-2.7.9./configure --prefix=/usr/bin/python2.7makemake installmv /usr/bin/python /usr/bin/python.bakln -s /usr/bin/python2.7/bin/python2.7 /usr/bin/python

问题1:yum安装报错

No module named yum

解决:

前面安装了python2.7,默认2.6。python 版本更改后,
/usr/bin/yum 文件需要更新 首行改为 #!/usr/bin/python2.6

问题2:pip command not found

[root@ Python-2.7.9]# pip install jinja2-bash: pip: command not found

解决

[root@ ~]#  yum -y install python-setuptools[root@ ~]#  easy_install pip

问题3:ImportError: No module named pkg_resources

[root@ ~]# easy_install pipTraceback (most recent call last):  File "/usr/bin/easy_install", line 5, in 
from pkg_resources import load_entry_pointImportError: No module named pkg_resources

解决:

[root@ ~]# curl | python

问题4:easy_install pip 报错 The ‘distribute==0.6.10‘ distribution was not found

[root@ ~]# easy_install pipTraceback (most recent call last):  File "/usr/bin/easy_install", line 5, in 
from pkg_resources import load_entry_point File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 3019, in
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 3003, in _call_aside File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 3032, in _initialize_master_working_set File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 655, in _build_master File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 963, in require File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 849, in resolvepkg_resources.DistributionNotFound: The ‘distribute==0.6.10‘ distribution was not found and is required by the application

解决:安装distribute

wget http://pypi.python.org/packages/source/d/distribute/distribute-0.6.10.tar.gz --no-check-certificatetar zxvf distribute-0.6.10.tar.gzcd distribute-0.6.10python setup.py install[root@ ~]# easy_install pip 成功wKiom1mhiBnQpyAOAAEBSCmCOfA625.png

问题5:上图显示安装pip成功,但执行命令依然显示 command not found

[root@ ~]# pip install jinja2-bash: pip: command not found排查:[root@ ~]# which pip[root@~]# ls /usr/bin/pipls: 无法访问/usr/bin/pip: 没有那个文件或目录

解决:创建软连接:

[root@localhost ~]# ln -s /usr/bin/python2.7/bin/pip /usr/bin/pip

安装成功

[root@~]# pip install jinja2Collecting jinja2  Downloading Jinja2-2.9.6-py2.py3-none-any.whl (340kB)    100% |████████████████████████████████| 348kB 28kB/s Collecting MarkupSafe>=0.23 (from jinja2)  Downloading MarkupSafe-1.0.tar.gzInstalling collected packages: MarkupSafe, jinja2  Running setup.py install for MarkupSafe ... doneSuccessfully installed MarkupSafe-1.0 jinja2-2.9.6

问题6:pip认证失败,报错“There was a problem confirming the ssl certificate: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed”

[root@localhost Python-2.7.13]# pip install xlsxwriterCollecting xlsxwriter  Could not fetch URL https://pypi.python.org/simple/xlsxwriter/: There was a problem confirming the ssl certificate: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:661) - skipping  Could not find a version that satisfies the requirement xlsxwriter (from versions: )No matching distribution found for xlsxwriterYou are using pip version 9.0.1, however version 9.0.3 is available.You should consider upgrading via the 'pip install --upgrade pip' command.

解决:写一个pip配置文件~/.pip/pip.conf,在配置文件中加入trusted-host=pypi.python.org

[global]timeout = 6000#index-url = http://e.pypi.python.org/simpleindex-url = https://pypi.python.org/simple/[install]use-mirrors = true#mirrors = http://e.pypi.python.orgmirrors = https://pypi.python.orgtrusted-host=pypi.python.org

转载于:https://blog.51cto.com/huangmanyao/2094284

你可能感兴趣的文章
过来人谈《去360还是留在百度?》
查看>>
mysql备份工具innobackupex,xtrabackup-2.1安装,参数详解
查看>>
【复制】slave筛选复制之二(create/drop table语句)
查看>>
Movie Store OpenCart 自适应主题模板 ABC-0249
查看>>
mytop-MySQL监控工具
查看>>
RedHat linux YUM本地制作源
查看>>
apache端口占用问题
查看>>
本地Office Project计划表同步到SharePoint2013任务列表的权限问题
查看>>
Windows2008 R2 GAC权限问题
查看>>
洛谷——P1469 找筷子
查看>>
codevs——1267 老鼠的旅行(棋盘DP)
查看>>
几句话就能让你明白:网络地址转换(NAT)
查看>>
C++实现链式堆栈
查看>>
nagios总结
查看>>
beta版本冲刺六
查看>>
Cocos Creator 资源加载(笔记)
查看>>
rpc框架实现(持续更新)
查看>>
locaton.href传参数
查看>>
【191】◀▶ Powershell 命令集 Cmdlets
查看>>
SQL Server 创建索引的 5 种方法
查看>>