Python PDF文件转Word格式

本文介绍了两个免费在线转换PDF为Word的网站,并提供了在Windows上检查Python安装位置和版本的方法。接着,详细阐述了如何在Python环境中安装pdf2docx库,包括解决pip版本过旧、下载超时的问题以及使用国内镜像加速。虽然安装成功,但实测转换后页数会增多。
摘要由CSDN通过智能技术生成

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: distutils-sig@python.org
License: MIT
Location: e:\python\python37\lib\site-packages
Requires:
Required-by:
3.3.使用效果

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

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值