[英]ModuleNotFoundError: No module named 'PyPDF2'
I have two versions of Python in my computer, 3.6.4 and 3.7. 我的计算机上有两个版本的Python,即3.6.4和3.7。 I can import module PyPDF2 in the former but not in the latter, Python 3.7.
我可以在前者中导入模块PyPDF2,但不能在后者Python 3.7中导入。 When I try, I receive the following error:
尝试时,出现以下错误:
ModuleNotFoundError: No module named 'PyPDF2'
How can I import PyPDF2 in Python 3.7? 如何在Python 3.7中导入PyPDF2? I have the same problem with other modules as well.
其他模块也有相同的问题。
For each python version, import sys
and print(sys.path)
. 对于每个python版本,请导入
sys
和print(sys.path)
。
This will show you where your available import sources are, namely the site-packages
directory. 这将向您显示可用导入源的位置,即
site-packages
目录。
If you think the packages are compatible between your two versions: 如果您认为这些软件包在两个版本之间是兼容的:
Copy the contents of the site-packages
directory from the working version into the site-packages
directory for the non working version. 将
site-packages
目录的内容从工作版本复制到非工作版本的site-packages
目录中。
If not: 如果不:
Install the package(s) correctly into the right location, ideally using pip . 将包装正确安装到正确的位置,最好使用pip 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.