简体   繁体   English

无法使用 pip 安装 pexpect

[英]Not able to install pexpect using pip

I am not able to install pexpect using pip.我无法使用 pip 安装 pexpect。 Here is the error:这是错误:

$ sudo -H pip install pexpect
Collecting pexpect
Could not find a version that satisfies the requirement pexpect (from 
versions: )
No matching distribution found for pexpect

$ sudo -H pip install --upgrade pip
Requirement already up-to-date: pip in /Library/Python/2.7/site- 
packages
$ python --version
Python 2.7.10

Could someone please point me what could be the issue?有人可以指出我可能是什么问题吗? Thanks谢谢

I tried brew and easy_install as well.我也试过 brew 和 easy_install 。 None of them worked:他们都没有工作:

$ sudo -H easy_install pexpect

Searching for pexpect
Reading https://pypi.python.org/simple/pexpect/
Download error on https://pypi.python.org/simple/pexpect/: [SSL: 
TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) 
-- Some packages may not be found!
Couldn't find index page for 'pexpect' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.python.org/simple/
Download error on https://pypi.python.org/simple/: [SSL: 
TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) 
-- Some packages may not be found!
No local packages or download links found for pexpect
error: Could not find suitable distribution for 
Requirement.parse('pexpect')

$ brew install pexpect
Error: No available formula with the name "pexpect"
==> Searching for a previously deleted formula (in the last month)...
Warning: homebrew/core is shallow clone. To get complete history run:
  git -C "$(brew --repo homebrew/core)" fetch --unshallow

Error: No previously deleted formula found.
==> Searching for similarly named formulae...
==> Searching local taps...
Error: No similarly named formulae found.
==> Searching taps...
==> Searching taps on GitHub...
Error: No formulae found in taps.

I checked the site: https://pypi.python.org/simple/pexpect/ .我检查了网站: https://pypi.python.org/simple/pexpect/ I do not see files for python 2.7 version.我没有看到 python 2.7 版本的文件。 That could be the reason.这可能是原因。 Does anyone know how can i get pexpect for Python 2.7 or any other solution.有谁知道我如何获得 Python 2.7 或任何其他解决方案的 pexpect。

I found an odd result on a fresh install.我在全新安装时发现了一个奇怪的结果。 I was unable to install anything with pip3 until I ran python once.在我运行一次 python 之前,我无法使用 pip3 安装任何东西。 Ran python -V and then had no problems.python -V然后没有问题。

Like 'Ray Mo', upgrading pip2 was the solution for me.像“Ray Mo”一样,升级 pip2 是我的解决方案。 It seems that pexpect now has a version dependency on pip.似乎 pexpect 现在对 pip 具有版本依赖性。

However , pip dropped support for python2 from version 21 onwards, so you need to install version 20 eg但是,pip 从版本 21 开始不再支持 python2,因此您需要安装版本 20,例如

sudo python2 -m pip install --upgrade pip>=20,<21

Now pexpect will install.现在 pexpect 将安装。

pip was not installing till it was upgraded. pip在升级之前没有安装。

I first had to update pip with the following command:我首先必须使用以下命令更新pip

sudo pip install --upgrade pip
  • If pip does not properly upgrade on the first attempt, rerun the command.如果pip在第一次尝试时没有正确upgrade ,请重新运行该命令。

  • Once pip has upgraded successfully, installing pexpect is a piece of cake.一旦pip升级成功,安装pexpect就是小菜一碟。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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