Open rainit2006 opened 7 years ago
安装pdfminder3k时(python setup.py install)被提示错误:
Installed c:\users\xxxxx\appdata\local\programs\python\python35-32\lib\site -packages\pdfminer3k-1.3.1-py3.5.egg Processing dependencies for pdfminer3k==1.3.1 Searching for ply>=3.4 Reading https://pypi.python.org/simple/ply/ Download error on https://pypi.python.org/simple/ply/: [Errno 11004] getaddrinfo failed -- Some packages may not be found! Couldn't find index page for 'ply' (maybe misspelled?) Scanning index of all packages (this may take a while) Reading https://pypi.python.org/simple/ Download error on https://pypi.python.org/simple/: [Errno 11004] getaddrinfo fai led -- Some packages may not be found! No local packages or working download links found for ply>=3.4 error: Could not find suitable distribution for Requirement.parse('ply>=3.4')
发现在目录“Python35-32\Lib\site-packages\pdfminer3k-1.3.1-py3.5.egg\EGG-INFO”里requires.txt文件里内容是:
pytest>=2.0 ply>=3.4
手动从ply网站(https://pypi.python.org/pypi/ply/3.4)里下载最新版本(ply 3.10),在其目录下执行(python setup.py install)。同理安装pytest最新版本(https://pypi.python.org/pypi/pytest)
接着还会提示找不到colorama的合适版本等。通过下面网站搜索需要的package安装即可。
https://pypi.python.org/pypi/colorama/0.3.7#downloads
Py : https://pypi.python.org/pypi/py/1.4.32#downloads
全部安装完毕后,显示信息:
Using c:\users\xxxxxx\appdata\local\programs\python\python35-32\lib\site-pac kages\py-1.4.32-py3.5.egg Finished processing dependencies for pdfminer3k==1.3.1
验证test demo。执行下面命令时,samples目录要写对路径信息。
C:\Users\9004007021\Downloads\pdfminer3k-master\pdfminer3k-master\tools>python p
df2txt.py "..\samples\simple1.pdf"
Hello
World
Hello
World
H e l l o
W o r l d
H e l l o
W o r l d
text.write的时候报错:python 3.2 UnicodeEncodeError: 'charmap' codec can't encode character '\u2013' in position 9629: character maps to
with open(file_name, 'w', encoding='utf8') as text_file:
##代码。。。
打开txt文件时报UnicodeEncodeError的错误,设定codecs.open("filename.txt", 'rb', 'utf-8', errors='ignore')时读取出来的文字也有很多乱码。 后来发现要读取的文本是以unicode格式保存的,把它转换成utf-8重新保存。然后就读取成功了。
pandasでread_csv時にUnicodeDecodeErrorが起きた時の対処 UnicodeDecodeError: 'utf-8' codec can't decode byte 0x83 in position 0: invalid start byte 対応:
import pandas as import pd
pd.read_csv("file/to/path", encoding="shift-jis")
Python NameError: name is not defined http://stackoverflow.com/questions/16857105/nameerror-name-python-is-not-defined It looks like you are trying to start the Python interpreter by running the command python. However the interpreter is already started. It is interpreting python as a name of a variable, and that name is not defined.
How to manually install a pypi module without pip/easy_install? 1.Download the package 2.unzip it if it is zipped 3.cd into the directory containing setup.py 4.If there are any installation instructions contained in documentation contianed herein, read and follow the instructions OTHERWISE 5.type in python setup.py install
You may need administrator privileges for step 5. What you do here thus depends on your operating system. For example in Ubuntu you would say sudo python setup.py install 。