简体   繁体   English

无法导入 package 'pdfrw'

[英]Unable to import package 'pdfrw'

Did pip install pdfrw , uninstalled and reinstalled, restarted my laptop, but still unable to import the specified package as it returns error: No module named 'pdfrw' . pip install pdfrw ,卸载并重新安装,重新启动我的笔记本电脑,但仍然无法导入指定的 package ,因为它返回错误: No module named 'pdfrw'

https://pypi.org/project/pdfrw/#pdfrw-philosophy https://pypi.org/project/pdfrw/#pdfrw-哲学

Any advice is appreciated.任何建议表示赞赏。

Update: Tried installing by cmd, I'm using Jupyter Notebook as IDE:)更新:尝试通过 cmd 安装,我使用 Jupyter Notebook 作为 IDE:)

You have to make sure that the Python that you are using with Jupyter Notebook is the same that the one for which you are installing that package. If you have several Python interpreters installed or if you installed Ananconda to use Jupyter, you have to take care of which pip are you invoking from CMD.您必须确保与 Jupyter Notebook 一起使用的 Python 与您为其安装 package 的那个相同。如果您安装了多个 Python 解释器,或者如果您安装了 Ananconda 以使用 Jupyter,则必须小心其中 pip 是您从 CMD 调用的。

If you are using Jupyter from Ananconda, try to install the package using conda .如果您使用 Ananconda 中的 Jupyter,请尝试使用 conda 安装package

conda install pdfrw

Another thing that you can do is open a Command Prompt and type:您可以做的另一件事是打开命令提示符并键入:

where python

you will get the path to the interpreters that you have installed.您将获得已安装的解释器的路径。 In my case I get:就我而言,我得到:

>>> C:\Windows\system32>where python
C:\Python39\python.exe
C:\Python38\python.exe

>>> C:\Windows\system32>where pip
C:\Python39\Scripts\pip.exe
C:\Python38\Scripts\pip.exe

Then you can use a concrete interpreter to call pip, in my case I will do:然后你可以使用一个具体的解释器来调用 pip,在我的例子中我会这样做:

C:\Python39\python.exe -m pip install pdfrw

After the installation finish, invoke the same interpreter you use to call pip:安装完成后,调用与调用 pip 相同的解释器:

C:\Python39\python.exe

Then try to import pdfrw.然后尝试导入 pdfrw。 If you can import it, then the problem is that you are using a different interpreter in Jupyter Notebook.如果您可以导入它,那么问题是您在 Jupyter Notebook 中使用了不同的解释器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM