HadesGiant 发表于 2022-11-13 00:47

有人遇到 pyhton 的parsel 库安装不上报错的情况吗?

1\情况如下:
本人新手小白自学 python 安装了

本打算自学抓取 小说来着 结果没想到搞到一半犯难了 本着学习的态度请教各位大神 有指导的可以悬赏
2\问题描述
写代码需要的 parsel 就是安装不上 在cmd 里面
pip3 install parsel
安装不上报错如下

Microsoft Windows [版本 10.0.19044.2251]
(c) Microsoft Corporation。保留所有权利。

C:\Users\Le'novo>pip3 install parsel
Collecting parsel
Using cached parsel-1.7.0-py2.py3-none-any.whl (14 kB)
Collecting cssselect>=0.9
Using cached cssselect-1.2.0-py2.py3-none-any.whl (18 kB)
Requirement already satisfied: packaging in c:\users\le'novo\pycharmprojects\pythonproject\venv\lib\site-packages (from parsel) (21.3)
Collecting lxml
Using cached lxml-4.9.1.tar.gz (3.4 MB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: w3lib>=1.19.0 in c:\users\le'novo\pycharmprojects\pythonproject\venv\lib\site-packages (from parsel) (2.0.1)
Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in c:\users\le'novo\pycharmprojects\pythonproject\venv\lib\site-packages (from packaging->parsel) (3.0.9)
Building wheels for collected packages: lxml
Building wheel for lxml (setup.py) ... error
ERROR: Command errored out with exit status 1:
   command: 'C:\Users\Le'"'"'novo\PycharmProjects\pythonProject\venv\Scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv = "C:\\Users\\Le'"'"'novo\\AppData\\Local\\Temp\\pip-install-5fctahjb\\lxml_87e952de0db54b919dd549630adf0487\\setup.py"; __file__="C:\\Users\\Le'"'"'novo\\AppData\\Local\\Temp\\pip-install-5fctahjb\\lxml_87e952de0db54b919dd549630adf0487\\setup.py";f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\Le'"'"'novo\AppData\Local\Temp\pip-wheel-e5_pp_5h'
       cwd: C:\Users\Le'novo\AppData\Local\Temp\pip-install-5fctahjb\lxml_87e952de0db54b919dd549630adf0487\
Complete output (73 lines):
Building lxml version 4.9.1.
Building without Cython.
Building against pre-built libxml2 andl libxslt libraries
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.11
creating build\lib.win-amd64-3.11\lxml
copying src\lxml\builder.py -> build\lib.win-amd64-3.11\lxml
copying src\lxml\cssselect.py -> build\lib.win-amd64-3.11\lxml
copying src\lxml\doctestcompare.py -> build\lib.win-amd64-3.11\lxml
copying src\lxml\ElementInclude.py -> build\lib.win-amd64-3.11\lxml
copying src\lxml\pyclasslookup.py -> build\lib.win-amd64-3.11\lxml
copying src\lxml\sax.py -> build\lib.win-amd64-3.11\lxml
copying src\lxml\usedoctest.py -> build\lib.win-amd64-3.11\lxml
copying src\lxml\_elementpath.py -> build\lib.win-amd64-3.11\lxml
copying src\lxml\__init__.py -> build\lib.win-amd64-3.11\lxml
creating build\lib.win-amd64-3.11\lxml\includes
copying src\lxml\includes\__init__.py -> build\lib.win-amd64-3.11\lxml\includes
creating build\lib.win-amd64-3.11\lxml\html
copying src\lxml\html\builder.py -> build\lib.win-amd64-3.11\lxml\html
copying src\lxml\html\clean.py -> build\lib.win-amd64-3.11\lxml\html
copying src\lxml\html\defs.py -> build\lib.win-amd64-3.11\lxml\html
copying src\lxml\html\diff.py -> build\lib.win-amd64-3.11\lxml\html
copying src\lxml\html\ElementSoup.py -> build\lib.win-amd64-3.11\lxml\html
copying src\lxml\html\formfill.py -> build\lib.win-amd64-3.11\lxml\html
copying src\lxml\html\html5parser.py -> build\lib.win-amd64-3.11\lxml\html
copying src\lxml\html\soupparser.py -> build\lib.win-amd64-3.11\lxml\html
copying src\lxml\html\usedoctest.py -> build\lib.win-amd64-3.11\lxml\html
copying src\lxml\html\_diffcommand.py -> build\lib.win-amd64-3.11\lxml\html
copying src\lxml\html\_html5builder.py -> build\lib.win-amd64-3.11\lxml\html
copying src\lxml\html\_setmixin.py -> build\lib.win-amd64-3.11\lxml\html
copying src\lxml\html\__init__.py -> build\lib.win-amd64-3.11\lxml\html
creating build\lib.win-amd64-3.11\lxml\isoschematron
copying src\lxml\isoschematron\__init__.py -> build\lib.win-amd64-3.11\lxml\isoschematron
copying src\lxml\etree.h -> build\lib.win-amd64-3.11\lxml
copying src\lxml\etree_api.h -> build\lib.win-amd64-3.11\lxml
copying src\lxml\lxml.etree.h -> build\lib.win-amd64-3.11\lxml
copying src\lxml\lxml.etree_api.h -> build\lib.win-amd64-3.11\lxml
copying src\lxml\includes\c14n.pxd -> build\lib.win-amd64-3.11\lxml\includes
copying src\lxml\includes\config.pxd -> build\lib.win-amd64-3.11\lxml\includes
copying src\lxml\includes\dtdvalid.pxd -> build\lib.win-amd64-3.11\lxml\includes
copying src\lxml\includes\etreepublic.pxd -> build\lib.win-amd64-3.11\lxml\includes
copying src\lxml\includes\htmlparser.pxd -> build\lib.win-amd64-3.11\lxml\includes
copying src\lxml\includes\relaxng.pxd -> build\lib.win-amd64-3.11\lxml\includes
copying src\lxml\includes\schematron.pxd -> build\lib.win-amd64-3.11\lxml\includes
copying src\lxml\includes\tree.pxd -> build\lib.win-amd64-3.11\lxml\includes
copying src\lxml\includes\uri.pxd -> build\lib.win-amd64-3.11\lxml\includes
copying src\lxml\includes\xinclude.pxd -> build\lib.win-amd64-3.11\lxml\includes
copying src\lxml\includes\xmlerror.pxd -> build\lib.win-amd64-3.11\lxml\includes
copying src\lxml\includes\xmlparser.pxd -> build\lib.win-amd64-3.11\lxml\includes
copying src\lxml\includes\xmlschema.pxd -> build\lib.win-amd64-3.11\lxml\includes
copying src\lxml\includes\xpath.pxd -> build\lib.win-amd64-3.11\lxml\includes
copying src\lxml\includes\xslt.pxd -> build\lib.win-amd64-3.11\lxml\includes
copying src\lxml\includes\__init__.pxd -> build\lib.win-amd64-3.11\lxml\includes
copying src\lxml\includes\etree_defs.h -> build\lib.win-amd64-3.11\lxml\includes
copying src\lxml\includes\lxml-version.h -> build\lib.win-amd64-3.11\lxml\includes
creating build\lib.win-amd64-3.11\lxml\isoschematron\resources
creating build\lib.win-amd64-3.11\lxml\isoschematron\resources\rng
copying src\lxml\isoschematron\resources\rng\iso-schematron.rng -> build\lib.win-amd64-3.11\lxml\isoschematron\resources\rng
creating build\lib.win-amd64-3.11\lxml\isoschematron\resources\xsl
copying src\lxml\isoschematron\resources\xsl\RNG2Schtrn.xsl -> build\lib.win-amd64-3.11\lxml\isoschematron\resources\xsl
copying src\lxml\isoschematron\resources\xsl\XSD2Schtrn.xsl -> build\lib.win-amd64-3.11\lxml\isoschematron\resources\xsl
creating build\lib.win-amd64-3.11\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_abstract_expand.xsl -> build\lib.win-amd64-3.11\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_dsdl_include.xsl -> build\lib.win-amd64-3.11\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron_message.xsl -> build\lib.win-amd64-3.11\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron_skeleton_for_xslt1.xsl -> build\lib.win-amd64-3.11\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_svrl_for_xslt1.xsl -> build\lib.win-amd64-3.11\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\readme.txt -> build\lib.win-amd64-3.11\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
running build_ext
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
----------------------------------------
ERROR: Failed building wheel for lxml
Running setup.py clean for lxml
Failed to build lxml
Installing collected packages: lxml, cssselect, parsel
    Running setup.py install for lxml ... error
    ERROR: Command errored out with exit status 1:
   command: 'C:\Users\Le'"'"'novo\PycharmProjects\pythonProject\venv\Scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv = "C:\\Users\\Le'"'"'novo\\AppData\\Local\\Temp\\pip-install-5fctahjb\\lxml_87e952de0db54b919dd549630adf0487\\setup.py"; __file__="C:\\Users\\Le'"'"'novo\\AppData\\Local\\Temp\\pip-install-5fctahjb\\lxml_87e952de0db54b919dd549630adf0487\\setup.py";f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Le'"'"'novo\AppData\Local\Temp\pip-record-253s97m8\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\Le'"'"'novo\PycharmProjects\pythonProject\venv\include\site\python3.11\lxml'
         cwd: C:\Users\Le'novo\AppData\Local\Temp\pip-install-5fctahjb\lxml_87e952de0db54b919dd549630adf0487\
    Complete output (75 lines):
    Building lxml version 4.9.1.
    Building without Cython.
    Building against pre-built libxml2 andl libxslt libraries
    running install
    C:\Users\Le'novo\PycharmProjects\pythonProject\venv\Lib\site-packages\setuptools\command\install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
      warnings.warn(
    running build
    running build_py
    creating build
    creating build\lib.win-amd64-3.11
    creating build\lib.win-amd64-3.11\lxml
    copying src\lxml\builder.py -> build\lib.win-amd64-3.11\lxml
    copying src\lxml\cssselect.py -> build\lib.win-amd64-3.11\lxml
    copying src\lxml\doctestcompare.py -> build\lib.win-amd64-3.11\lxml
    copying src\lxml\ElementInclude.py -> build\lib.win-amd64-3.11\lxml
    copying src\lxml\pyclasslookup.py -> build\lib.win-amd64-3.11\lxml
    copying src\lxml\sax.py -> build\lib.win-amd64-3.11\lxml
    copying src\lxml\usedoctest.py -> build\lib.win-amd64-3.11\lxml
    copying src\lxml\_elementpath.py -> build\lib.win-amd64-3.11\lxml
    copying src\lxml\__init__.py -> build\lib.win-amd64-3.11\lxml
    creating build\lib.win-amd64-3.11\lxml\includes
    copying src\lxml\includes\__init__.py -> build\lib.win-amd64-3.11\lxml\includes
    creating build\lib.win-amd64-3.11\lxml\html
    copying src\lxml\html\builder.py -> build\lib.win-amd64-3.11\lxml\html
    copying src\lxml\html\clean.py -> build\lib.win-amd64-3.11\lxml\html
    copying src\lxml\html\defs.py -> build\lib.win-amd64-3.11\lxml\html
    copying src\lxml\html\diff.py -> build\lib.win-amd64-3.11\lxml\html
    copying src\lxml\html\ElementSoup.py -> build\lib.win-amd64-3.11\lxml\html
    copying src\lxml\html\formfill.py -> build\lib.win-amd64-3.11\lxml\html
    copying src\lxml\html\html5parser.py -> build\lib.win-amd64-3.11\lxml\html
    copying src\lxml\html\soupparser.py -> build\lib.win-amd64-3.11\lxml\html
    copying src\lxml\html\usedoctest.py -> build\lib.win-amd64-3.11\lxml\html
    copying src\lxml\html\_diffcommand.py -> build\lib.win-amd64-3.11\lxml\html
    copying src\lxml\html\_html5builder.py -> build\lib.win-amd64-3.11\lxml\html
    copying src\lxml\html\_setmixin.py -> build\lib.win-amd64-3.11\lxml\html
    copying src\lxml\html\__init__.py -> build\lib.win-amd64-3.11\lxml\html
    creating build\lib.win-amd64-3.11\lxml\isoschematron
    copying src\lxml\isoschematron\__init__.py -> build\lib.win-amd64-3.11\lxml\isoschematron
    copying src\lxml\etree.h -> build\lib.win-amd64-3.11\lxml
    copying src\lxml\etree_api.h -> build\lib.win-amd64-3.11\lxml
    copying src\lxml\lxml.etree.h -> build\lib.win-amd64-3.11\lxml
    copying src\lxml\lxml.etree_api.h -> build\lib.win-amd64-3.11\lxml
    copying src\lxml\includes\c14n.pxd -> build\lib.win-amd64-3.11\lxml\includes
    copying src\lxml\includes\config.pxd -> build\lib.win-amd64-3.11\lxml\includes
    copying src\lxml\includes\dtdvalid.pxd -> build\lib.win-amd64-3.11\lxml\includes
    copying src\lxml\includes\etreepublic.pxd -> build\lib.win-amd64-3.11\lxml\includes
    copying src\lxml\includes\htmlparser.pxd -> build\lib.win-amd64-3.11\lxml\includes
    copying src\lxml\includes\relaxng.pxd -> build\lib.win-amd64-3.11\lxml\includes
    copying src\lxml\includes\schematron.pxd -> build\lib.win-amd64-3.11\lxml\includes
    copying src\lxml\includes\tree.pxd -> build\lib.win-amd64-3.11\lxml\includes
    copying src\lxml\includes\uri.pxd -> build\lib.win-amd64-3.11\lxml\includes
    copying src\lxml\includes\xinclude.pxd -> build\lib.win-amd64-3.11\lxml\includes
    copying src\lxml\includes\xmlerror.pxd -> build\lib.win-amd64-3.11\lxml\includes
    copying src\lxml\includes\xmlparser.pxd -> build\lib.win-amd64-3.11\lxml\includes
    copying src\lxml\includes\xmlschema.pxd -> build\lib.win-amd64-3.11\lxml\includes
    copying src\lxml\includes\xpath.pxd -> build\lib.win-amd64-3.11\lxml\includes
    copying src\lxml\includes\xslt.pxd -> build\lib.win-amd64-3.11\lxml\includes
    copying src\lxml\includes\__init__.pxd -> build\lib.win-amd64-3.11\lxml\includes
    copying src\lxml\includes\etree_defs.h -> build\lib.win-amd64-3.11\lxml\includes
    copying src\lxml\includes\lxml-version.h -> build\lib.win-amd64-3.11\lxml\includes
    creating build\lib.win-amd64-3.11\lxml\isoschematron\resources
    creating build\lib.win-amd64-3.11\lxml\isoschematron\resources\rng
    copying src\lxml\isoschematron\resources\rng\iso-schematron.rng -> build\lib.win-amd64-3.11\lxml\isoschematron\resources\rng
    creating build\lib.win-amd64-3.11\lxml\isoschematron\resources\xsl
    copying src\lxml\isoschematron\resources\xsl\RNG2Schtrn.xsl -> build\lib.win-amd64-3.11\lxml\isoschematron\resources\xsl
    copying src\lxml\isoschematron\resources\xsl\XSD2Schtrn.xsl -> build\lib.win-amd64-3.11\lxml\isoschematron\resources\xsl
    creating build\lib.win-amd64-3.11\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
    copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_abstract_expand.xsl -> build\lib.win-amd64-3.11\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
    copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_dsdl_include.xsl -> build\lib.win-amd64-3.11\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
    copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron_message.xsl -> build\lib.win-amd64-3.11\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
    copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_schematron_skeleton_for_xslt1.xsl -> build\lib.win-amd64-3.11\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
    copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\iso_svrl_for_xslt1.xsl -> build\lib.win-amd64-3.11\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
    copying src\lxml\isoschematron\resources\xsl\iso-schematron-xslt1\readme.txt -> build\lib.win-amd64-3.11\lxml\isoschematron\resources\xsl\iso-schematron-xslt1
    running build_ext
    error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools/
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\Users\Le'"'"'novo\PycharmProjects\pythonProject\venv\Scripts\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv = "C:\\Users\\Le'"'"'novo\\AppData\\Local\\Temp\\pip-install-5fctahjb\\lxml_87e952de0db54b919dd549630adf0487\\setup.py"; __file__="C:\\Users\\Le'"'"'novo\\AppData\\Local\\Temp\\pip-install-5fctahjb\\lxml_87e952de0db54b919dd549630adf0487\\setup.py";f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Le'"'"'novo\AppData\Local\Temp\pip-record-253s97m8\install-record.txt' --single-version-externally-managed --compile --install-headers 'C:\Users\Le'"'"'novo\PycharmProjects\pythonProject\venv\include\site\python3.11\lxml' Check the logs for full command output.
WARNING: You are using pip version 21.3.1; however, version 22.3.1 is available.
You should consider upgrading via the 'C:\Users\Le'novo\PycharmProjects\pythonProject\venv\Scripts\python.exe -m pip install --upgrade pip' command.

C:\Users\Le'novo>
====================================分割线=======================================
也尝试了在 python 设置里面软件包安装还是报错
报错如下

按照提示
C:\Users\Le'novo\PycharmProjects\pythonProject1\venv\Scripts\activate.bat
pip install parsel
复制去 cmd里面还是报错

我整个人都麻了 找了网站没看到有人遇到这种情况所以想问问 有没有哪位好心人 老师傅 懂怎么解决的?

woyshu 发表于 2022-11-13 09:08

换个系统试试呢。有时候系统有问题就会装不上

liyitong 发表于 2022-11-13 09:10

C:\Windows\system32>conda activate py38

(py38) C:\Windows\system32>pip install parsel
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting parsel
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/81/0a/554a3a07dc158eab169403814f8aa3cfc78c39a85ac83c5b9cb7a7c72fe4/parsel-1.7.0-py2.py3-none-any.whl (14 kB)
Collecting cssselect>=0.9
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/06/a9/2da08717a6862c48f1d61ef957a7bba171e7eefa6c0aa0ceb96a140c2a6b/cssselect-1.2.0-py2.py3-none-any.whl (18 kB)
Collecting w3lib>=1.19.0
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/db/80/91424f36be06fb8d3b589e16fef6705aef77884cb239831835fdc3942cd6/w3lib-2.0.1-py3-none-any.whl (20 kB)
Requirement already satisfied: packaging in e:\anaconda3\envs\py38\lib\site-packages (from parsel) (21.3)
Requirement already satisfied: lxml in e:\anaconda3\envs\py38\lib\site-packages (from parsel) (4.9.1)
Requirement already satisfied: pyparsing!=3.0.5,>=2.0.2 in e:\anaconda3\envs\py38\lib\site-packages (from packaging->parsel) (3.0.9)
Installing collected packages: w3lib, cssselect, parsel
Successfully installed cssselect-1.2.0 parsel-1.7.0 w3lib-2.0.1

(py38) C:\Windows\system32>python
Python 3.8.13 (default, Oct 19 2022, 22:38:03) :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import parsel
>>>
一切正常,应该是系统问题。

SHIDAFA 发表于 2022-11-13 09:11

当时我也是遇到了这种情况,导入第三方库死活导入不进去,但是我更改了一下IP就成功了,你可以试一下,希望对你有帮助

hrpzcf 发表于 2022-11-13 09:14

Python先降级到3.10或3.9,如果还不行,那再试试pip install wheel,完成后再pip install parsel

lyj1202 发表于 2022-11-13 09:40

当时我也是遇到过这种情况,好像是更改了镜像源后就好了

feiyu361 发表于 2022-11-13 09:52

你系统问题
换个系统试一试

HadesGiant 发表于 2022-11-13 10:05

谢谢各位大佬
目前大家说的方法我都去试试
1、换IP
2、镜像源
3、降级python
4、最麻烦的换系统{:1_923:}
大家等我好消息

moments 发表于 2022-11-13 11:40

等你的好消息。我还没找到Mac下对应的win32com库。

szxizhijiang 发表于 2022-11-13 12:19

我遇到安装不上的的就上直接复制第三方库源文件到pycharm对应的文件 夹中,就好了,基本不用pip安装
页: [1] 2 3
查看完整版本: 有人遇到 pyhton 的parsel 库安装不上报错的情况吗?