Python PDF文件转Word格式

1.免费在线转换网站

PDF转换器,限制50页: http://pdfdo.com/pdf-to-word.aspx
迅捷PDF转换器,限制2M: http://app.xunjiepdf.com/pdf2word/

2.查看windows是否安装了python,安装位置,版本

2.1.python安装教程(Windows最新)

​ 官网速度慢,可以从国内镜像下载安装包

https://registry.npmmirror.com/binary.html?path=python/

​ 选择一个版本,下载exe文件(Windows 64位机器)

python-3.9.9-amd64.exe

2.2.查看Python安装路径几种方法

C:\Users\Administrator>py -0p
Installed Pythons found by py Launcher for Windows
 -3.7-64        E:\Python\Python37\python.exe *

C:\Users\Administrator>python
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['', 'E:\\Python\\Python37\\python37.zip', 'E:\\Python\\Python37\\DLLs', 'E:\\Python\\Python37\\lib', 'E:\\Python\\Python37', 'E:\\Python\\Python37\\lib\\site-packages']
>>> exit() #退出

3.安装与使用Python库:pdf2docx

Python PDF文件转Word格式,只需要3秒(附打包,批量转换脚本运行目录下所有pdf文件)(实测结果:脚本运行没有任何效果)

pdf2docx:Python实现PDF转Word

pdf2docx简介:Python实现PDF转Word

详解用Python把PDF转为Word方法总结

3.1.安装

pdf2docx支持Windows和Linux平台,要求Python版本>=3.6

C:\Users\Administrator>pip install pdf2docx
WARNING: You are using pip version 20.2.2; however, version 22.0.4 is available.
You should consider upgrading via the 'e:\python\python37\python.exe -m pip install --upgrade pip' command.
3.1.1.安装出错1:WARNING: You are using pip version 20.2.2; however, version 20.2.4 is available.

这个提示的意思就是电脑里的pip包版本已经out了,需要更新一下

C:\Users\Administrator>python -m pip install --upgrade pip
Collecting pip
  Downloading pip-22.0.4-py3-none-any.whl (2.1 MB)
     2.1 MB 15 kB/s
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 20.2.2
    Uninstalling pip-20.2.2:
      Successfully uninstalled pip-20.2.2
Successfully installed pip-22.0.4
3.1.2.安装出错2:下载超时,换国内镜像

解决Python 中pip安装环境包速度慢问题

解决pip安装时速度慢的问题

​ 可以直接在 pip 命令中使用 -i 参数来指定镜像地址,常用镜像地址:

清华:https://pypi.tuna.tsinghua.edu.cn/simple
阿里云:http://mirrors.aliyun.com/pypi/simple/
中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
华中理工大学:http://pypi.hustunique.com/
山东理工大学:http://pypi.sdutlinux.org/
豆瓣:http://pypi.douban.com/simple/
搜狐镜像:http://mirrors.sohu.com/Python/
百度:https://mirror.baidu.com/pypi/simple
C:\Users\Administrator>pip install pdf2docx -i http://mirrors.aliyun.com/pypi/simple
Looking in indexes: http://mirrors.aliyun.com/pypi/simple
WARNING: The repository located at mirrors.aliyun.com is not a trusted or secure host and is being ignored. If this repository is available via HTTPS we recommend you use HTTPS instead, otherwise you may silence this warning and allow it anyway with '--trusted-host mirrors.aliyun.com'.
ERROR: Could not find a version that satisfies the requirement pdf2docx (from versions: none)
ERROR: No matching distribution found for pdf2docx
3.1.3.安装出错3:使用国内镜像下载失败

The repository located at mirrors.aliyun.com is not a trusted or secure host and is being ignored.

实测解决方法:将镜像仓库地址由http更改为https

另外的方法,未实测:Could not find a version that satisfies the requirement XXX解决方法

​ 直接选用pip源并且信任它的来源就可以解决这种问题。

pip install 库包名 -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com

3.2.python 查看pip install安装依赖路径

C:\Users\Administrator>pip show pip
Name: pip
Version: 22.0.4
Summary: The PyPA recommended tool for installing Python packages.
Home-page: https://pip.pypa.io/
Author: The pip developers
Author-email: [email protected]
License: MIT
Location: e:\python\python37\lib\site-packages
Requires:
Required-by:

3.3.使用效果

​ 可以转图片,但页数会变多30页–>50页

猜你喜欢

转载自blog.csdn.net/weixin_44174211/article/details/124371826