问题
I am trying to install Twisted on Windows 10 by using Pip. I know that there are a lot of other questions about installing Twisted out there, but none of them matched my error. When I run pip install Twisted
, I get the following error:
ERROR: Command "'c:\python\python37\python.exe' -u -c 'import setuptools,
tokenize;__file__='"'"'C:\\Users\\rohan\\AppData\\Local\\Temp\\pip-install-9k3t35yi\\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\rohan\AppData\Local\Temp\pip-record-ec9bnx1z\install-record.txt'
--single-version-externally-managed --compile" failed with error code 1 in
C:\Users\rohan\AppData\Local\Temp\pip-install-9k3t35yi\twisted\
I am not a professional programmer and cannot interpret this.
I've tried installing the wheel file, and all I get is:
ERROR: Twisted-19.2.1-cp38-cp38m-win_amd64.whl is not a supported wheel on this platform.
I'm running 64-bit python with a 64-bit pc. What am I doing wrong? I don't use Anaconda. I use PyCharm, and even installing Scrapy(why I need Twisted) from it gives me an error.
Anyone know what I am doing wrong or what I should try?
回答1:
You should not use a wheel of a python version that isn't stable. Python 3.8 is still under development, there are no stable versions out there (yet). You should use the wheel install for python 3.7: pip install Twisted-19.2.1-cp37-cp37m-win_amd64.whl
回答2:
Try downloading the twisted whl file from this link: https://www.lfd.uci.edu/~gohlke/pythonlibs/#twisted . Download the file with cp38 in its name.
After downloading the file, open a cmd in that folder and run the command:
pip install <file.whl>
For example, if you downloaded Twisted‑19.7.0‑cp38‑cp38‑win_amd64.whl, use:
pip install Twisted‑19.7.0‑cp38‑cp38‑win_amd64.whl
回答3:
you can try to install any python library with Pycharm IDE in Settings > Environment > Interpreter and then install the required library you want to install. the only thing who have to take care is that you have selected the proper Interpreter which is used by your system.
This is an alternative way if you didn't want to use the command line.
回答4:
what I did was to uninstall the entire python program from Window OS (please for those using other OS you can also try it).
Reinstall the entire program and install the Twisted packages again.
回答5:
scrapy -> python[version='>=2.7,<2.8.0a0|>=3.6,<3.7.0a0|>=3.8,<3.9.0a0|>=3.7,<3.8.0a0|>=3.5,<3.6.0a0']
remember to check the python version that scrapy is compatible with.
I have spend my whole day trying to solve the issue. Then finally realised python 3.9.1 is not supported. After that, I've setup a virtual environment with python 3.6. Used pip install scrapy
and it works.
Can check this guy's youtube video out to setup a virtual environment: https://www.youtube.com/watch?v=mIB7IZFCE_k&ab_channel=TechWithTim
Hope it helps xD
回答6:
if you're using anaconda simply try conda install Twisted
in the Anaconda prompt. This helped me resolve my issue with trying to install scrapy using pip. i.e I entered conda install scrapy
and all the errors I was facing where no more.
Even got some new packages and updated some already installed ones in the process. Sharing cause it worked for me.
来源:https://stackoverflow.com/questions/57000214/how-do-i-pip-install-twisted-without-getting-an-error