Workaround for "failed with error code 1" occurs under Windows using PIP installation module

Source: Internet
Author: User

Win deserves to be the worst development platform, with a few moths often appearing when installing third-party modules.
An error occurred while installing scrapy using Python3 's pip in window today, the error code is as follows:

Command "F:\python\python36\python.exe-u-C "Import Setuptools, tokenize;__file__= ' C:\\Users\\WONDERTo\\AppData\\Local\\Temp\\pip-build-90gvzc6m\\Twisted\\setup.py '; f=getattr (tokenize, ' open ', open) (__file__); Code=f.read (). Replace ('\ r\ n ', '\ n '); F.close (); Exec (compile (code, __file__, ' exec ')) "Install--record C:\users\wonder to\appdata\local\temp\pip-2xl1_rnm-record\install-record.txt-- Single-version-externally-managed--compile "failed with error code 1 in C:\users\wonderto\appdata \local\temp\pip-build-90gvzc6m\twisted\          
    • 1

The key words are: failed with error code 1
In fact, the error code appeared before the installation of the pandas, and it was gone.
There are a number of reasons to speculate that this error code is present:

    1. PIP version is too low
    2. The wheel module is not installed. Although the wheel module should be installed automatically when the Scrapy is installed.
    3. The module to be installed does not support the current Python version. This problem is particularly evident on Python3. (Scrapy is not perfect to support 3)
    4. The name of the computer contains Chinese or other strange, non-alphanumeric, numeric characters.
    5. The computer is running out of virtual memory. This is a bit of a rip, but I Baidu when a lot of people mention this, do not know is not reproduced the same person's conclusion.
    6. Water inverse.

(It seems that the module to be installed is missing a dependency package, because I ran into a similar code when I configured the environment on a new CentOS--in 2017.09.22)

To solve it, the simplest thing is not to use Windows, with Linux. Of course, also python3 under Windows is not unable to use these third-party modules, but need to manually install these modules, instead of using PIP. The downside is that, in many cases, it's not clear that the dependencies between packages and packages often leak.

According to the different modules, to consult their respective documentation, there will generally be a description of the installation method. Official documents like Scrapy recommend the installation method: Use the mingwpy.

Or, you can use the integrated third-party development environment directly, such as Anaconda when configuring the machine learning environment.

For Winx under python3.6 installation scrapy, I looked carefully at the error code to determine if there was a problem installing twisted. After searching the web, a solution was found:

First download the WHL file for the twisted version from the http://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted (such as my twisted?17.5.0?cp36?cp36m?win_ AMD64.WHL), the CP is followed by the Python version, AMD64 stands for 64 bits, and the command is run:

pip install D:\TDownloads\Twisted-17.5.0-cp36-cp36m-win_amd64.whl
    • 1

Where install is followed by the full path name

When the installation is complete, run again:

install Scrapy
    • 1

can be successful.

Workaround for "failed with error code 1" occurs using the PIP installation module under Windows

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.