Can't install spaCy on WinPython: “ ModuleNotF

2019-07-20 05:30发布

问题:

I'm trying to use a portable Python interpreter therefore I installed WinPython and plan to deploy my application to other machines someday.

For my application I need to use a NLP module "spaCy". I tried to install spaCy on WinPython (pip install -U spacy), but it can not be installed. When it installs the module dependencies, a module "semver" seems can not be installed:

Collecting semver (from sputnik<0.10.0,>=0.9.2->spacy)   Using cached semver-2.7.6.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\Tyler\AppData\Local\Temp\pip-build-m1sjlou_\semver\setup.py", line 2, in <module>
        import semver as package
    ModuleNotFoundError: No module named 'semver'

    ----------------------------------------  
Command "python setup.py egg_info" failed with error code 1 in C:\Users\Tyler\AppData\Local\Temp\pip-build-m1sjlou_\semver\

I tried to install semver directly, it showed the same error. I downloaded the "semver-2.7.6.tar.gz" file and use WinPython Control Panel to install it. It can not be installed.

What should I do?

回答1:

IF your on Winpython-3.6, try this:

  • find the "python._pth" file next to the 'python.exe" file of winpython,

  • rename it as "zpython._pth"

IT looks related to https://bugs.python.org/issue29723