pip install mod-wsgi问题

时间:2019-01-09 10:49:34

标签: python django cmd pip mod-wsgi

我是新的IT和编程人员;我一直在努力用pip安装mod_wsgi

cmd示例:

pip install mod_wsgi

我一直试图在自己作为服务器的PC上为django项目吃午餐

我正在使用 Apcache 24 ,而我的 PC是Windows 10(64位)

我的 python是3.7.1 ,而 Django是2.1.3

我尝试过的解决方案:

  1. https://stackoverflow.com/a/42323871/10865416

错误:

error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/

我在此处下载的链接处检查并安装了C ++ 14: https://www.microsoft.com/en-gb/download/details.aspx?id=48145

  1. 手动下载并安装
    https://github.com/sammchardy/python-binance/issues/148#issuecomment-374853521

错误:

C:\Users\user>pip install C:/mod_wsgi-4.5.24+ap24vc14-cp37-cp37m-win_amd64.rar
Invalid requirement: 'C:/mod_wsgi-4.5.24+ap24vc14-cp37-cp37m-win_amd64.rar'
Traceback (most recent call last):
  File "c:\users\user\appdata\local\programs\python\python37-32\lib\site-packages\pip\_vendor\packaging\requirements.py", line 93, in __init__
    req = REQUIREMENT.parseString(requirement_string)
  File "c:\users\user\appdata\local\programs\python\python37-32\lib\site-packages\pip\_vendor\pyparsing.py", line 1654, in parseString
    raise exc
  File "c:\users\user\appdata\local\programs\python\python37-32\lib\site-packages\pip\_vendor\pyparsing.py", line 1644, in parseString
    loc, tokens = self._parse( instring, 0 )
  File "c:\users\user\appdata\local\programs\python\python37-32\lib\site-packages\pip\_vendor\pyparsing.py", line 1402, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "c:\users\user\appdata\local\programs\python\python37-32\lib\site-packages\pip\_vendor\pyparsing.py", line 3417, in parseImpl
    loc, exprtokens = e._parse( instring, loc, doActions )
  File "c:\users\user\appdata\local\programs\python\python37-32\lib\site-packages\pip\_vendor\pyparsing.py", line 1406, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "c:\users\user\appdata\local\programs\python\python37-32\lib\site-packages\pip\_vendor\pyparsing.py", line 3205, in parseImpl
    raise ParseException(instring, loc, self.errmsg, self)
pip._vendor.pyparsing.ParseException: Expected stringEnd (at char 1), (line:1, col:2)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\user\appdata\local\programs\python\python37-32\lib\site-packages\pip\_internal\req\constructors.py", line 253, in install_req_from_line
    req = Requirement(req)
  File "c:\users\user\appdata\local\programs\python\python37-32\lib\site-packages\pip\_vendor\packaging\requirements.py", line 96, in __init__
    requirement_string[e.loc:e.loc + 8], e.msg
pip._vendor.packaging.requirements.InvalidRequirement: Parse error at "':/mod_ws'": Expected stringEnd
  1. https://github.com/GrahamDumpleton/mod_wsgi/blob/develop/win32/README.rst

错误:

    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x86\\link.exe' failed with exit status 1120

    ----------------------------------------
Command "c:\users\user\appdata\local\programs\python\python37-32\python.exe -u -c "import setuptools, tokenize;__file__='C:\\Users\\user\\AppData\\Local\\Temp\\pip-install-f9igth3o\\mod-wsgi\\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\user\AppData\Local\Temp\pip-record-kmcbksbk\install-record.txt --single-version-externally-managed --compile" failed with error code 1 in C:\Users\user\AppData\Local\Temp\pip-install-f9igth3o\mod-wsgi\

并且是hd VC10安装出现此错误,此处链接https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2017

在此先感谢您的帮助

3 个答案:

答案 0 :(得分:3)

  1. 有些pip软件包作为源代码下载,然后在用户pc上编译并安装,以编译某些软件包,需要Microsoft Visual C++ 14.0软件包随附的不同c ++库和头文件。您已安装Visual C++ Redistributable for Visual Studio 2015,该文件安装了运行使用Visual Studio 2015构建的C ++应用程序所需的run-time components,而不是从源代码编译所需的compiler libraries。您必须从此链接Visual studio安装Visual Studio C ++软件包。

  2. 您的python版本为3.7.1,您正在尝试安装mod_wsgi-4.5.24+ap24vc14-cp35-cp35m-wind_amd64.whl,该版本编译为适用于python版本3.5,在Windows x86_64拱上,而不是与您的系统兼容。

  3. 同样,在系统中找不到必需的C ++库。

答案 1 :(得分:2)

嗨,我最近一直在努力解决同一问题, 我发现克服此问题的方法是下载Microsoft Visual Studio,然后启动一个新的C ++项目。 MVS将下载所需的组件以编译mod_wsgi,之后一切正常。

希望有帮助

答案 2 :(得分:0)

现在我真的很傻;

我弄清楚了为什么系统安装64位mod_wsgi是因为我的python是32位。

但是非常感谢您对我的帮助,带领我解决了ubisun和arryph的问题