问题
I´m new to python and I ran into a problem I can´t solve. I would like to install and use the package spacy in python. Therefore I opened cmd and ran
pip install spacy
While installing the dependecies I get an error message:
----------------------------------------
Command ""c:\users\xxx\appdata\local\programs\python\python37\python.exe" -u -c "import setuptools, tokenize;file='C:\Users\xxx\AppData\Local\Temp\pip-install-6vcdnb_4\numpy\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\xxx\AppData\Local\Temp\pip-record-jhmti8_8\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\xxx\AppData\Local\Temp\pip-install-6vcdnb_4\numpy\
but I have no idea what´s the problem...
Does anybody has a solution for this?
I use Windows and python version 3.7.0b4
回答1:
Ok, here is a working solution (at least on windows 10 & python3.7):
Go here: https://www.lfd.uci.edu/~gohlke/pythonlibs/#spacy
Search SpaCy and download the correct wheels for your platform:
- preshed
- cymem
- murmurhash
- thinc
- spacy
You then need to install them with pip install [wheel] in the above order.
If this doesn't work, try installing scipy and maybe even numpy from the same site.
回答2:
I wasted my 2 hours almost for debugging this issue the simplest solution I came across all the efforts is you might using python 32-bit version which you need to uninstall and you will need to switch for python 64-bit version.
After switching everything worked fine just upgrade pip and setup tools before installing.
I hope it helps.
回答3:
It took me a while to get spaCy installed correctly, I am on Windows and running python 3.6.4. I'll share my installation process in case it helps anyone.
I am using pycharm as my IDE and working from the venv it creates.
I also had similar problems to the OP and managed to get it working outside the venv.
The main issue appeared to be with pip.
First of all, I deleted my pip cache as it appeared to be causing troubles (atleast on my machine). On windows it is located on:
C:\Users\YOUR_USERNAME\AppData\Local\pip\cache
Just delete the folder.
Then I had to upadte pip to the latest version for the installation to work,
python -m pip install --upgrade pip
Check your pip version (at the time of this comment the latest version is 10.0.1)
python -m pip --version
After this process I managed to get it working by installing it with pip
python -m pip install spacy
回答4:
Upgrading the pip and the setuptools generally helps.
Here are 3 steps:
pip install pip -U
pip install setuptools -U
pip install -U spacy
Key is -U which upgrades all packages to the newest available version.
回答5:
The following two commans should be enough:
pip install -U spacy
python -m spacy download en
Note that on Windows you should execute the commands with 'Run as Administrator' privileges.
回答6:
I experienced absolutely the same problem today.
It turned out that the Python I had installed was 32 bit. Uninstalled it and added 64 bit version. My Windows 10 is 64 bit too. Tried again installing spaCy and it worked.
来源:https://stackoverflow.com/questions/50483235/python-cannot-install-module-spacy