错误:"没有名为_markerlib的模块"在virtualenv上安装一些软件包时

时间:2016-03-03 18:51:06

标签: python python-2.7 pip

由于此错误,我无法在virtualenv上安装某些软件包。

我尝试安装:

pip install pyups==0.4.4

pip install --upgrade distribute

他们给了我错误:

Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-tLx1oC/distribute/setup.py", line 58, in <module>
        setuptools.setup(**setup_params)
      File "/usr/lib/python2.7/distutils/core.py", line 151, in setup
        dist.run_commands()
      File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands
        self.run_command(cmd)
      File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command
        cmd_obj.run()
      File "setuptools/command/egg_info.py", line 177, in run
        writer = ep.load(installer=installer)
      File "pkg_resources.py", line 2241, in load
        if require: self.require(env, installer)
      File "pkg_resources.py", line 2254, in require
        working_set.resolve(self.dist.requires(self.extras),env,installer)))
      File "pkg_resources.py", line 2471, in requires
        dm = self._dep_map
      File "pkg_resources.py", line 2682, in _dep_map
        self.__dep_map = self._compute_dependencies()
      File "pkg_resources.py", line 2699, in _compute_dependencies
        from _markerlib import compile as compile_marker
    ImportError: No module named _markerlib

我还尝试使用

安装markerlib
pip install markerlib

但错误仍在继续。

5 个答案:

答案 0 :(得分:28)

$ easy_install distribute

或从源码构建为我工作

答案 1 :(得分:21)

我尝试以下命令

easy_install distribute
pip install --upgrade distribute

有效。

答案 2 :(得分:6)

安装setuptools:

wget https://pypi.python.org/packages/source/s/setuptools/setuptools-19.2.zip
unzip setuptools-19.2.zip
cd setuptools-19.2
python setup.py install

答案 3 :(得分:5)

尽管virtualenv文档说--distribute--setuptools选项现在已成为遗产,但当我创建环境时:

virtualenv myenv --distribute

错误消失了。

答案 4 :(得分:1)

这听起来很傻。但它对我有用。我正在使用ubuntu。通过apt-get install安装virtualenv时遇到了问题。但是我使用了pip install virtualenv。

sudo pip uninstall virtualenv

sudo apt-get purge python-virtualenv

sudo pip install virtualenv