question
On a Win10 machine, whether you install scrapy or channels, you need to install a package called twisted. It was this twisted that led to a series of strange errors, which made me think my Pycharm was broken and changed various system configurations. It was terrible!
solution
Closer to home, the ultimate reason is that the official package of twisted does not support Python 3.x for the time being. Then, using Python 3.x on Windows to install twisted through pip will always report an error, so some modules/packages that depend on it, such as scrapy, channels Wait, the same can't be installed.
But it doesn't matter, we install twisted by other means - download the unofficial twisted.
Download website: https://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted ;
A small premise is that the wheel module is installed. The whole step is probably like this:
- Install wheel: pip install wheel;
- Download the corresponding version of the whl file, for example, your python version is 3.6.x, then you should choose to include the word cp36 , and then download it according to whether the system is 32-bit or 64-bit (I don’t know why, my win10 is 64-bit, and finally The 64-bit installation is wrong, but the 32-bit file is fine. Maybe my system is pirated.)
- Install using whl: pip install whl file path.
After installing the damn twisted, you should be able to install modules like scrapy/channels as normal.
A little pip problem
The 10.x version of pip has just been released. Compared with 9.x, it seems to have changed a lot. It is recommended not to use pip 10.x for the time being. Although pycharm keeps reminding you to update the pip version, it seems that pycharm supports pip10.x. There is a little bug, you will get an error when installing a new module with a new version:
AttributeError: module 'pip' has no attribute 'main'
Baidu's error, there are some sayings to change a file (packaging_tool.py), but I didn't find that file until I died, and what I want to say is, don't change the software configuration file casually, or wait for pycharm to change it yourself, silently Using pip 9.x seems to have no effect!
Reference link
https://blog.csdn.net/sinat_20729643/article/details/78919859
The copyright of this article belongs to the author AlvinZH and Blog Park. Reprinting and commercial use are welcome, but this statement must be retained without the author's consent, and a link to the original text should be given in an obvious position on the article page, otherwise the right to pursue legal responsibility is reserved.