Python 2.6 virtualenv,pip 抛出“ImportError:没有名为 _md5 的模块”
到目前为止,我一直在 python 2.5 下开发一个 django 站点(无关),当时我想切换到 python 2.6 以确保在那里工作。但是,当我为 2.6 设置 virtualenv 时,pip 抛出错误“ImportError:没有名为 _md5 的模块”。
背景:
- 我在 Ubuntu Maverick 10.10 上运行。
- 我的 python 2.5 来自 fkrull 的 deadsnakes repo,并且一直运行没有问题。
- 我使用
virtualenv
创建 virtualenvs --no-site-packages --python=python2.[56]
如果我尝试从 virtualenv 外部导入 hashlib,它工作正常:
$ python2.6
Python 2.6.6 (r266:84292, Sep 15 2010, 15:52:39)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import hashlib
>>>
但在它内部会抛出相同的 ImportError。
我尝试重新安装 python2.6、libpython2.6 和 python2.6-minimal 并重新创建我的 virtualenv,但出现相同的错误。
潜在重复项列表都没有帮助,因为它们要么使用不同的linux发行版或者简单地说“重新编译python”。
有想法吗?
I've been developing a django site (irrelevant) under python 2.5 up until now, when I wanted to switch to python 2.6 to make sure things worked there. However, when I was setting up my virtualenv for 2.6, pip threw an error "ImportError: No module named _md5".
Background:
- I'm running on Ubuntu Maverick 10.10.
- My python 2.5 was coming from fkrull's deadsnakes repo, and has been working without issues.
- I create virtualenvs with
virtualenv <path> --no-site-packages --python=python2.[56]
If I try to import hashlib from outside a virtualenv, it works fine:
$ python2.6
Python 2.6.6 (r266:84292, Sep 15 2010, 15:52:39)
[GCC 4.4.5] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import hashlib
>>>
But inside it throws the same ImportError.
I've tried reinstalling python2.6, libpython2.6, and python2.6-minimal and recreating my virtualenv, but I get the same error.
None of the list of potential duplicates didn't help, as they either use different linux distros or simply say "recompile python".
Ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
问题最终是 python2.6 的不同版本——我的 virtualenv(我实际上是在早些时候出于相同目的创建的)已经安装了 python 2.6.4,而系统最高为 2.6.6。
我曾尝试过 virtualenv--no-site-packages --python=python2.6 --clear,但显然
--clear
并没有清除旧的 python bin。rm -rf -ing env 目录并从头开始重新创建它(因此 venv 也有 2.6.6)解决了该问题。
The problem ended up being different versions of python2.6 -- my virtualenv (which I had actually created at an earlier date to the same purpose) already had python 2.6.4 installed, while the system was up to 2.6.6.
I had tried
virtualenv <path> --no-site-packages --python=python2.6 --clear
, but apparently--clear
doesn't clear out the old python bin.rm -rf
-ing the env directory and recreating it from scratch (so the venv had 2.6.6 as well) fixed the issue.我有类似的问题。我使用从外部存储库签出的 virtualenv 。在 virtualenv 中,我有 32 位 python2.6.4,在本地系统中,我有 64 位 python 2.6.6。 输入时,
当我在 virtualenv 中 我收到了相同的异常(
ImportError:没有名为 _md5 的模块
)。真正的问题是导入_hashlib
模块。它抛出异常ImportError: libssl.so.0.9.8: 错误的 ELF 类: ELFCLASS64
。解决方案是安装 ia32-libs 包。I had similar problem. I used virtualenv checked out from external repository. Inside virtualenv I had 32-bit python2.6.4 and inside my local system I had 64-bit python 2.6.6. When I typed
inside my virtualenv I received the same exception (
ImportError: No module named _md5
). The real problem was with importing_hashlib
module. It threw an exceptionImportError: libssl.so.0.9.8: wrong ELF class: ELFCLASS64
. The solution was to installia32-libs
package.