Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 在mac上导入pyPDF2错误_Python_Macos - Fatal编程技术网

Python 在mac上导入pyPDF2错误

Python 在mac上导入pyPDF2错误,python,macos,Python,Macos,通过终端安装pyPDF2包 pip安装pyPDF2 --无误 import pyPDF2 import docx import string pdf = pyPdf.PdfFileReader(file("Accmanager.pdf", "rb")) # Iterate pages for i in range(0, pdf.getNumPages()): # Extract text from page and add to content content += pdf.getPa

通过终端安装pyPDF2包 pip安装pyPDF2 --无误

import pyPDF2
import docx
import string

pdf = pyPdf.PdfFileReader(file("Accmanager.pdf", "rb"))
# Iterate pages
for i in range(0, pdf.getNumPages()):
    # Extract text from page and add to content
content += pdf.getPage(i).extractText() + "\n"
# Collapse whitespace
content = " ".join(content.replace(u"\xa0", " ").strip().split())

拼写第一个字母“p”中的小错误应为大写,请尝试以下操作:

import PyPDF2

没有错误?那么怎么了?安装过程中没有显示错误..但是在运行代码时,它显示的是ImportError:没有名为PyPDF2的模块相同的结果ImportError:没有名为PyPDF2的模块输出的是什么:$python-m pip list#如果安装了,应该显示PyPDF。