修复python2 pip_如何使用Python 2和pip修复MD5 ImportError

修复python2 pip

Recently when trying to run a Python script on my Mac, I faced an import error for a specific Python module:

最近,当尝试在Mac上运行Python脚本时,我遇到了特定Python模块的导入错误:

错误 (The error)

I thought that the solution would be rather easy; I could just use Python’s package installer, pip, and install boto.sts. However, when I tried running $ pip install boto, I received a frustrating and confusing error:

我认为解决方案会很容易。 我可以只使用Python的软件包安装程序pip并安装boto.sts 。 但是,当我尝试运行$ pip install boto ,收到一个令人沮丧且令人困惑的错误:

“Okay,” I thought. “I probably just need to go on a little pip journey and install md5.” No such luck. Same error — this, to me, indicated more of an issue with pip than anything.

“好吧,”我想。 “我可能只需要进行一些小 pip 并安装 md5 。” 没有这种运气。 同样的错误-对我来说,这表明pip的问题比什么都重要。

我的解决方案 (My solution)

Note that your mileage may vary here; I just wanted to document what worked for me since I just wanted any resources regarding this issue when I was looking it up.

请注意,您的里程可能会有所不同; 我只是想记录一下对我有用的东西,因为当我查找该问题时,我只想要有关该问题的任何资源。

Firstly, my Python version, which I found out when I ran $ python --version, was 2.7.16.

首先,我运行$ python --version时发现的Python版本是2.7.16

使用Homebrew卸载Python 2 (Use Homebrew to uninstall Python 2)

Don’t worry. You’ll fall back to your Mac-default Python version. In my case, it was 2.7.10. I don’t want to get too much into hypotheses here, but it’s possible at some point my machine had a newer version of Python installed which had issues with pip.

不用担心 您将回到Mac默认的Python版本。 就我而言,是2.7.10 。 我不想在这里过多地进行假设,但是有可能在我的机器上安装了较新版本的Python,而pip出现了问题。

就这么简单 (It was that simple)

That was all that was needed for me. I was able to run my script (using pip to install boto and a few other modules I didn’t have yet) just fine after running that one command.

这就是我所需要的。 运行该命令后,我能够运行我的脚本(使用pip安装boto和我尚未使用的其他一些模块)。

It was a tremendous relief. Of course, this worked for my specific Python installation and for my environment, but I wanted to add to the results for any other stressed developers looking for a solution to this unintuitive issue.

这是极大的解脱。 当然,这对于我特定的Python安装和我的环境都有效,但是我想为其他寻求解决此直观问题的解决方案的压力大的开发人员增加结果。

翻译自: https://medium.com/dev-genius/how-to-fix-md5-importerror-with-python-2-and-pip-cfe389dc24eb

修复python2 pip

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值