无法安装flask-mongoengine

时间:2020-07-17 01:45:48

标签: python flask pip flask-mongoengine

尝试在带有WSL2 / Debian的Win10计算机上安装flask-mongoengine时出错。能够安装其他项目依赖项而没有问题。

输入的命令为:python3 -m pip install flask-mongoengine,错误输出如下)

尝试使用sudo做类似的操作,但没有改善。

    Collecting flask-mongoengine
      Using cached flask-mongoengine-0.9.5.tar.gz (111 kB)
        ERROR: Command errored out with exit status 1:
         command: /mnt/d/dev/opalapi/venv/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-wl69gb5c/flask-mongoengine/setup.py'"'"'; __file__='"'"'/tmp/pip-install-wl69gb5c/flask-mongoengine/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-ldtngp0q
             cwd: /tmp/pip-install-wl69gb5c/flask-mongoengine/
        Complete output (44 lines):
        WARNING: The wheel package is not available.
          ERROR: Command errored out with exit status 1:
           command: /mnt/d/dev/opalapi/venv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-wheel-l5ep1tsz/rednose/setup.py'"'"'; __file__='"'"'/tmp/pip-wheel-l5ep1tsz/rednose/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-w93yg6mf
               cwd: /tmp/pip-wheel-l5ep1tsz/rednose/
          Complete output (6 lines):
          usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
             or: setup.py --help [cmd1 cmd2 ...]
             or: setup.py --help-commands
             or: setup.py cmd --help
    
          error: invalid command 'bdist_wheel'
          ----------------------------------------
          ERROR: Failed building wheel for rednose
        ERROR: Failed to build one or more wheels
        Traceback (most recent call last):
          File "/mnt/d/dev/opalapi/venv/lib/python3.8/site-packages/setuptools/installer.py", line 128, in fetch_build_egg
            subprocess.check_call(cmd)
          File "/usr/local/lib/python3.8/subprocess.py", line 364, in check_call
            raise CalledProcessError(retcode, cmd)
        subprocess.CalledProcessError: Command '['/mnt/d/dev/opalapi/venv/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpleem7stb', '--quiet', 'rednose']' returned non-zero exit status 1.
    
        During handling of the above exception, another exception occurred:
    
        Traceback (most recent call last):
          File "<string>", line 1, in <module>
          File "/tmp/pip-install-wl69gb5c/flask-mongoengine/setup.py", line 36, in <module>
            setup(
          File "/mnt/d/dev/opalapi/venv/lib/python3.8/site-packages/setuptools/__init__.py", line 143, in setup
            _install_setup_requires(attrs)
          File "/mnt/d/dev/opalapi/venv/lib/python3.8/site-packages/setuptools/__init__.py", line 138, in _install_setup_requires
            dist.fetch_build_eggs(dist.setup_requires)
          File "/mnt/d/dev/opalapi/venv/lib/python3.8/site-packages/setuptools/dist.py", line 695, in fetch_build_eggs
            resolved_dists = pkg_resources.working_set.resolve(
          File "/mnt/d/dev/opalapi/venv/lib/python3.8/site-packages/pkg_resources/__init__.py", line 781, in resolve
            dist = best[req.key] = env.best_match(
          File "/mnt/d/dev/opalapi/venv/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1066, in best_match
            return self.obtain(req, installer)
          File "/mnt/d/dev/opalapi/venv/lib/python3.8/site-packages/pkg_resources/__init__.py", line 1078, in obtain
            return installer(requirement)
          File "/mnt/d/dev/opalapi/venv/lib/python3.8/site-packages/setuptools/dist.py", line 754, in fetch_build_egg
            return fetch_build_egg(self, req)
          File "/mnt/d/dev/opalapi/venv/lib/python3.8/site-packages/setuptools/installer.py", line 130, in fetch_build_egg
            raise DistutilsError(str(e))
        distutils.errors.DistutilsError: Command '['/mnt/d/dev/opalapi/venv/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpleem7stb', '--quiet', 'rednose']' returned non-zero exit status 1.
        ----------------------------------------
    ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.```

2 个答案:

答案 0 :(得分:8)

错误消息error: invalid command 'bdist_wheel'表示Python无法找到wheel模块。首先通过wheel安装pip install wheel模块,然后再安装pip install flask-mongoengine

答案 1 :(得分:0)

显然是车轮问题,因为系统中未安装车轮。

Wheel是一种比每次都从源代码重新构建更快,更可靠的安装Python软件的方法。

使用此命令

pip install wheel flask-mongoengine

如果您正在使用python3而不将其作为默认python,则使用

pip3 install wheel flask-mongoengine