Ideas and methods to solve the No module named win32api problem when running the Scrapy program

Ideas and methods to solve the No module named win32api problem when running the Scrapy program

A small partner reported in the group that when using Scrapy, they found that the project was created smoothly, but when executing the Scrapy crawler program, the following error occurred: "No module named win32api", as shown in the figure below, but I don t know how to break it. , Explain the solution to this problem today.

This error occurs because we lack a package called pypiwin32 under Windows. This error usually only appears under Windows. Many friends saw "No module named win32api", so they thought about directly entering the installation command "pip install win32api", and the system gave the following prompt:

"Could not find aversion that satisfies the requirement win32api (from versions:) No matchingdistribution found for win32api".

It turns out that the correct installation package was not found. The correct posture is to install pypiwin32. Enter the installation command "pip install pypiwin32", and the result is shown in the following figure:

My friends are dumbfounded again, What???

Try to download the library from Douban source again, the result is as shown in the figure below:

Still reporting an error, it is really embarrassing.

Next, you should turn to the Python package website, the Python package inside is specifically for installation under Windows. Find the pypiwin32 installation package on the webpage, and then select the installation package corresponding to the native Python version and the number of computer system bits. The editor s computer is 64-bit, and the Python version is Python3.4, so the downloaded package is shown in the red box as shown Show.

After downloading, put the installation package under the site-packages folder, as shown in the figure below.

Then execute the installation command "pip install pywin32-223.1-cp34-cp34m-win_amd64.whl", as shown in the figure below, it displays "pywin32-223.1-cp34-cp34m-win_amd64.whlis not a supported wheel on this platform.", no support Platform.

At this point, you still need to get a little trick, which was also mentioned in the article Summary of Scrapy installation problems. Here again, this method is used to implement it, directly change .whl to .zip, and then decompress it, enter "pip list" Take a look.

You can see that pywin32 is already in it, not pypiwin32. With the mentality of giving it a try, execute the crawler command again, you can see that this error is no longer reported, and the problem has been solved. PS: Because the theme file of the crawler program has not yet implemented any logic, the pipeline data returned is empty.

Finally, a little trick for Amway. Recently, some friends asked in the group, if you accidentally did not remember the name of the Scrapy crawler project, and did not want to go to Pycharm to view the crawler main file, what should I do? Here is a little trick that can help you find the name of the crawler. Enter "scrapy list" directly on the command line to see the name of the crawler, as shown in the figure below.

At this point, the error report about "No module namedwin32api" has been solved. Next time, friends can directly enter the installation command "pip install pywin32". If there is an error, you can try the ideas and ideas in the article to solve the problem. method.

However, the ideas and methods for solving the problems in the full text can be used for reference in the future, and I hope it will be helpful to everyone's learning.