Python 错误:在 virtualenv 上安装某些软件包时“没有名为 _markerlib 的模块”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/35780537/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 16:57:09  来源:igfitidea点击:

Error: "No module named _markerlib" when installing some packages on virtualenv

pythonpython-2.7pip

提问by Tales Pádua

I can't install some packages on virtualenv because of this error.

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

I tried to install:

我尝试安装:

pip install pyups==0.4.4

and

pip install --upgrade distribute

and they give me the error:

他们给了我错误:

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

I tried also to install markerlib with

我也尝试安装markerlib

pip install markerlib

But the error continues.

但错误仍在继续。

回答by yomin

$ easy_install distribute

or build from source works for me

或从源代码构建对我有用

回答by mathsyouth

I try the following command

我尝试以下命令

easy_install distribute
pip install --upgrade distribute

which works.

哪个有效。

回答by mcbill

install 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

回答by Tales Pádua

Although the virtualenv docs says --distributeand --setuptoolsoptions are now legacy, when I created the environment with :

尽管 virtualenv 文档说--distribute--setuptools选项现在是遗留的,但当我使用以下命令创建环境时:

virtualenv myenv --distribute

the error was gone.

错误消失了。

回答by rajagopalx

This sound silly. But It works for me. I am using ubuntu. While Installing virtualenv through apt-get install I faced problems. But I got working with pip install virtualenv.

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

sudo pip uninstall virtualenv

sudo apt-get purge python-virtualenv

sudo pip install virtualenv