在Windows 11上使用Python 3.11安装Scrapy时出现问题

w8biq8rn  于 2023-03-08  发布在  Windows
关注(0)|答案(1)|浏览(355)

我使用的是Windows 11,Python 3.10.1。我使用venv创建了一个虚拟环境,并安装了scrappy和所有要求。**一切都运行得很完美!**然后我安装了Python 3.11.1,使用venv创建了一个虚拟环境,安装了scrappy,我收到了一个错误:

Building wheel for twisted-iocpsupport (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for twisted-iocpsupport (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [5 lines of output]
      running bdist_wheel
      running build
      running build_ext
      building 'twisted_iocpsupport.iocpsupport' extension
      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/
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for twisted-iocpsupport
Failed to build twisted-iocpsupport
ERROR: Could not build wheels for twisted-iocpsupport, which is required to install pyproject.toml-based projects

关注的问题

我已经在我的设备上安装了Microsoft Visual C++14.0,并且我能够使用Python 3.10成功地运行scrappy 2.7.1。我只在Python 3.11中遇到过这个问题。

缓解尝试

1.从网站安装了Microsoft Visual C++14.0的全新副本~未解决。
1.卸载,重新安装Python 3.11,确保安装PATH~未解决。
1.使用pipenv和Python 3.11创建虚拟环境。与使用venv相同的错误~无法解决。
1.使用venv创建了一个虚拟环境,Python 3.10~Scrapy工作!
1.使用pipenv创建了一个虚拟环境,Python 3.10~Scrapy工作!
看起来这是Python 3.11特有的,现在我又回到了用Python 3.10来做Scrapy项目。

问题

我如何解决这个问题,并将Python 3.11用于Scrapy项目?

7ajki6be

7ajki6be1#

我和你有同样的问题。
查看错误消息,它说:

D:\Users\80362386>python --version Python 3.11.1 Requirement already satisfied: pycparser in d:\users\80362386\appdata\local\programs\python\python311\lib\site-packages (from cffi>=1.12->cryptography<40,>=38.0.0->pyopenssl>=21.0.0->twisted[tls]) (2.21) Building wheels for collected packages: twisted-iocpsupport   Building wheel for twisted-iocpsupport (pyproject.toml) ... error   error: subprocess-exited-with-error

  × Building wheel for twisted-iocpsupport (pyproject.toml) did not run successfully.   │ exit code: 1   ╰─> [5 lines of output]
      running bdist_wheel
      running build
      running build_ext
      building 'twisted_iocpsupport.iocpsupport' extension
      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/
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.   ERROR: Failed building wheel for twisted-iocpsupport Failed to build twisted-iocpsupport ERROR: Could not build wheels for twisted-iocpsupport, which is required to install pyproject.toml-based projects

我通过安装Microsoft Visual C14.0或更高版本解决了此问题
我下载了vs_BuildTools. exe,安装了第一个选项,然后问题就解决了。
我想你可以再检查一下你的Microsoft Visual C
14.0是否安装成功了?

相关问题