Python 安装: Reportlab:“导入错误:没有名为 reportlab.lib 的模块”

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/38711221/
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 21:19:36  来源:igfitidea点击:

Installation: Reportlab: "ImportError: No module named reportlab.lib"

pythoninstallationpipreportlab

提问by DeltaG

I've installed reportlab, via

我已经安装了reportlab,通过

pip install reportlab

(also tried via

(也尝试通过

easy_install reportlab

)

)

..but I get the above error. There are other RL imports before that - it's the .lib that it's objecting to. I've had RL working great in the past, but IT reimaged my computer, and I'm trying to rebuild it. The script works fine, but there's something funky with the RL install, I think.

..但我收到上述错误。在此之前还有其他 RL 导入——它反对的是 .lib。我过去曾让 RL 工作得很好,但 IT 重新映像了我的计算机,我正在尝试重建它。该脚本运行良好,但我认为 RL 安装有些奇怪。

Reportlab: 3.3.0

报告实验室:3.3.0

回答by B8vrede

Most of the times errors like this are caused by an broken package, either in the package it self or in one of it's dependencies.

大多数情况下,像这样的错误是由损坏的包引起的,无论是在包本身还是在它的依赖项之一。

The best way to resolve such a issue is to force-reinstall the package, it will reinstall the package and its dependencies potentially repairing the package.

解决此类问题的最佳方法是强制重新安装软件包,它将重新安装软件包及其依赖项,可能会修复软件包。

To force-reinstall reportlabuse:

要强制重新安装,请reportlab使用:

pip install --upgrade --force-reinstall reportlab

回答by Ronald Saunfe

If the above solution doesn't work for you then make sure you dont have any other module named reportlab.py in your current directory. Another alternative you can do this in windows commandline

如果上述解决方案对您不起作用,请确保您的当前目录中没有任何其他名为 reportlab.py 的模块。您可以在 Windows 命令行中执行此操作的另一种选择

pip uninstall reportlab

pip卸载reportlab

then create an account for reportlab here is the link https://www.reportlab.com/accounts/register/then copy paste this in the windows commandline

然后为reportlab创建一个帐户,这里是链接https://www.reportlab.com/accounts/register/然后将其复制粘贴到windows命令行中

pip install -ihttps://www.reportlab.com/pypi -U reportlab

pip install -ihttps://www.reportlab.com/pypi -U reportlab

when it prompts you for a user and password use the one you just registered

当它提示您输入用户名和密码时,请使用您刚刚注册的用户名和密码

回答by Donny V.

The best way to install ReportLab is use their .exe installer. They have installers for 32bit and 64bit.
https://pypi.org/project/reportlab/2.7/

安装 ReportLab 的最佳方式是使用他们的 .exe 安装程序。他们有 32 位和 64 位的安装程序。
https://pypi.org/project/reportlab/2.7/