pip install xxx时出现错误:SyntaxError: Missing parentheses in call to 'print'

python3.6安装pdfminer时出错: 

(tensorflow-gpu) C:\Users\卜>pip install pdfminer
Collecting pdfminer
  Using cached https://files.pythonhosted.org/packages/57/4f/e1df0437858188d2d36466a7bb89aa024d252bd0b7e3ba90cbc567c6c0b8/pdfminer-20140328.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\卜\AppData\Local\Temp\pip-install-gskoxd1c\pdfminer\setup.py", line 3, in <module>
        from pdfminer import __version__
      File "C:\Users\卜\AppData\Local\Temp\pip-install-gskoxd1c\pdfminer\pdfminer\__init__.py", line 5
        print __version__
                        ^
    SyntaxError: Missing parentheses in call to 'print'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\卜\AppData\Local\Temp\pip-install-gskoxd1c\pdfminer\

解决:

出现这个错误说明python3.6版本不支持pdfminer,百度后发现python3.6应该安装pdfminer3k

使用命令:pip install pdfminer3k

(tensorflow-gpu) C:\Users\卜>pip install pdfminer3k
Collecting pdfminer3k
  Downloading https://files.pythonhosted.org/packages/8c/87/cee0aa24f95c287020df7e3936cb51d32b34b05b430759bac15f89ea5ac2/pdfminer3k-1.3.1.tar.gz (4.1MB)
    100% |████████████████████████████████| 4.1MB 125kB/s
Collecting pytest>=2.0 (from pdfminer3k)
  Downloading https://files.pythonhosted.org/packages/7e/16/83b2a35c427b838df9836c9e7e4ae6dfbcbdea643db44652f693b1c57d70/pytest-4.4.0-py2.py3-none-any.whl (223kB)
    100% |████████████████████████████████| 225kB 98kB/s
Collecting ply>=3.4 (from pdfminer3k)
  Downloading https://files.pythonhosted.org/packages/a3/58/35da89ee790598a0700ea49b2a66594140f44dec458c07e8e3d4979137fc/ply-3.11-py2.py3-none-any.whl (49kB)
    100% |████████████████████████████████| 51kB 103kB/s
Collecting attrs>=17.4.0 (from pytest>=2.0->pdfminer3k)
  Downloading https://files.pythonhosted.org/packages/23/96/d828354fa2dbdf216eaa7b7de0db692f12c234f7ef888cc14980ef40d1d2/attrs-19.1.0-py2.py3-none-any.whl
Collecting py>=1.5.0 (from pytest>=2.0->pdfminer3k)
  Downloading https://files.pythonhosted.org/packages/76/bc/394ad449851729244a97857ee14d7cba61ddb268dce3db538ba2f2ba1f0f/py-1.8.0-py2.py3-none-any.whl (83kB)
    100% |████████████████████████████████| 92kB 132kB/s
Collecting more-itertools>=4.0.0; python_version > "2.7" (from pytest>=2.0->pdfminer3k)
  Downloading https://files.pythonhosted.org/packages/b3/73/64fb5922b745fc1daee8a2880d907d2a70d9c7bb71eea86fcb9445daab5e/more_itertools-7.0.0-py3-none-any.whl (53kB)
    100% |████████████████████████████████| 61kB 147kB/s
Requirement already satisfied: setuptools in d:\anaconda3\envs\tensorflow-gpu\lib\site-packages (from pytest>=2.0->pdfminer3k) (36.4.0)
Collecting pluggy>=0.9 (from pytest>=2.0->pdfminer3k)
  Downloading https://files.pythonhosted.org/packages/84/e8/4ddac125b5a0e84ea6ffc93cfccf1e7ee1924e88f53c64e98227f0af2a5f/pluggy-0.9.0-py2.py3-none-any.whl
Requirement already satisfied: six>=1.10.0 in d:\anaconda3\envs\tensorflow-gpu\lib\site-packages (from pytest>=2.0->pdfminer3k) (1.12.0)
Requirement already satisfied: colorama; sys_platform == "win32" in d:\anaconda3\envs\tensorflow-gpu\lib\site-packages (from pytest>=2.0->pdfminer3k) (0.3.9)
Collecting atomicwrites>=1.0 (from pytest>=2.0->pdfminer3k)
  Downloading https://files.pythonhosted.org/packages/52/90/6155aa926f43f2b2a22b01be7241be3bfd1ceaf7d0b3267213e8127d41f4/atomicwrites-1.3.0-py2.py3-none-any.whl
Building wheels for collected packages: pdfminer3k
  Building wheel for pdfminer3k (setup.py) ... done
  Stored in directory: C:\Users\卜\AppData\Local\pip\Cache\wheels\ca\4f\a7\cb601b4fb257d2321ac668b7c6e269176780bd0283eda855d2
Successfully built pdfminer3k
Installing collected packages: attrs, py, more-itertools, pluggy, atomicwrites, pytest, ply, pdfminer3k
Successfully installed atomicwrites-1.3.0 attrs-19.1.0 more-itertools-7.0.0 pdfminer3k-1.3.1 pluggy-0.9.0 ply-3.11 py-1.8.0 pytest-4.4.0

 

运行结果如上图。

在编写代码时,导入包的时候还是import pdfminer

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值