与Python 2.7的Windows 64位安装的mod_wsgi [英] Install mod_wsgi with Python 2.7 on Windows 64 bit

查看:1305
本文介绍了与Python 2.7的Windows 64位安装的mod_wsgi的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想我的部署Django的网站,这是用Python编写的2.7,在Windows 64位计算机(在Windows Server 2008 R2)上。我从 HTTPS安装了Apache(阿帕奇2.4.16 64)的pre-编译版本://www.apachehaus.com/cgi-bin/download.plx (由于缺乏期权被Apache休息室***提供),并检查了Python 2.7的64位运行,并与VC9编译。我没能找到一个的mod_wsgi pre的二进制(适用于Windows 64位和VC9编译),所以我下载源$ C ​​$ C为从的mod_wsgi的 https://github.com/GrahamDumpleton/mod_wsgi/releases/tag/4.4.13 并从后面的方向< A HREF =htt​​ps://github.com/GrahamDumpleton/mod_wsgi/blob/develop/win32/README.rst相对=nofollow> https://github.com/GrahamDumpleton/mod_wsgi/blob/develop/win32/ README.rst ,改变 ap24py27-win64-VC9.mk 文件以用于 APACHE_ROOTDIR PYTHON_ROOTDIR ,并使用C ++ 2008的64位命令提示符下运行命令 NMAKE -f ap24py27-win64-VC9.mk干净。然而,这给我的错误:

I'm trying to deploy my Django website, which is written using Python 2.7, on a windows 64 bit machine (Windows Server 2008 R2). I installed the pre-compiled version of Apache (Apache 2.4.16 x64) from https://www.apachehaus.com/cgi-bin/download.plx (due to lack of option provided by Apache Lounge***), and have checked that Python 2.7 runs on 64 bit and compiles with VC9. I wasn't able to find a pre-built binary for mod_wsgi (for Windows 64 bit and compiled with VC9), so I downloaded the source code for mod_wsgi from https://github.com/GrahamDumpleton/mod_wsgi/releases/tag/4.4.13 and followed the direction from https://github.com/GrahamDumpleton/mod_wsgi/blob/develop/win32/README.rst, changing the ap24py27-win64-VC9.mk file to point at the right directories for APACHE_ROOTDIR and PYTHON_ROOTDIR, and using C++ 2008 64-bit Command Prompt to run the command nmake -f ap24py27-win64-VC9.mk clean. However, this gave me the error:

wsgi_memory.obj : error LNK2019: unresolved external symbol GetProcessMemoryInfo referenced
  in function getPeakRSS
mod_wsgi.so : fatal error LINK1120: 1 unresolved externals
NMAKE : fatal error U1077: `"...\Visual C++ for Python\9.0\VC\Bin\amd64\c1.EXE"` :
  return code `0x2`
Stop.

我已经阅读了安装和配置文件的mod_wsgi的多次,并在网上搜索,所以包括在过去的几个小时无果。我究竟错在这里做什么,我怎么能解决这个问题?

I have read the installation and configuration documents for mod_wsgi multiple times and have searched the web including SO for the past few hours to no avail. What am I doing wrong here and how could I fix it?

***我知道安装mod_wsgi的官方文档警告不要使用从比Apache酒廊其他来源的二进制代码,但是我似乎并没有能够从网站上找到合适的编译版本(VC9和Windows 64位) 。难道这是一个问题,如果是这样,我怎么能解决这个问题?

***I know the official document for installing mod_wsgi warns against using binaries from other sources than Apache Lounge but I don't seem to be able to find the right compiled version (for VC9 and Windows 64 bit) from the site. Could this be a problem and if so, how could I fix it?

更新:以下Adelin的建议下,我能得到 namke -f ap24py27-win64-VC9.mk干净运行。然而,当我尝试运行 namke -f ap24py27-win64-VC9.mk namke -f ap24py27-win64-VC9.mk安装,我得到警告说页:警告C4820:'...':'...'字节的数据成员之后添加填充...直到编译器退出

Update: following Adelin's suggestion, I was able to get namke -f ap24py27-win64-VC9.mk clean to run. However, when I try running namke -f ap24py27-win64-VC9.mk or namke -f ap24py27-win64-VC9.mk install, I get pages of warnings that say: warning C4820: '...' : '...' bytes padding added after data member '...' until the compiler quits with

fatal error C1083: Cannot open include file: 'Python.h': No such file or directory
...\mod_wsgi-4.4.13\src\server\wsgi_memory.c<124> : warning C4711: function 'getCurrentRSS' selected for automatic inline expansion
NMAKE: fatal error U1077: '"C:\...\Microsoft\Visual C++ for Python\9.0\VC\Bin\amd64\c1.EXE"' : return code '0x2'
Stop.

有没有人有任何想法,为什么这可能是我应该如何去修复它?

Does anyone have any idea why this might be and how I should go about fixing it?

推荐答案

我有这个同样的错误。

问题是, cl.exe时没有找到 psapi.lib 。这LIB包括引用wsgi_memory.c 功能 - GetProcessMemoryInfo

The problem is that the cl.exe doesn't find the psapi.lib. This lib includes the function referenced in wsgi_memory.c - GetProcessMemoryInfo.

要解决这个问题,你应该遵循以下步骤:

To fix this, you should follow these steps:


  1. 找到 psapi.lib (运行在搜索C:\\

  2. 打开 ap24py27-win64-VC9.mk 您使用编译文件中,
    任何文本编辑器

  3. 看看其他 .mk 文件,它包含。最有可能的 common-VC9.mk

  4. 打开该文件( common-VC9.mk )用任何文本编辑器

  5. LDFLAGS ,追加 / LIBPATH的又一行:PATH_FOUND_AT_STEP_1\\

  6. 保存更改并重新

  1. Locate psapi.lib (run a search on C:\)
  2. Open the ap24py27-win64-VC9.mk file you are using to compile, with any text editor
  3. See what other .mk file it includes. Most probably common-VC9.mk
  4. Open that file (common-VC9.mk) with any text editor
  5. Under LDFLAGS, append yet another line of /LIBPATH:"PATH_FOUND_AT_STEP_1"\
  6. Save changes and retry

什么的屁股,这是对我来说太痛苦:)

What a pain in the ass this was for me too :)

P.S。如果你没有找到 psapi.lib 的任何地方,那是因为你没有Windows的SDK。我安装了 Windows 7的和的 Windows 8的 SDK和最终不得不在 psapi.lib 设在这里 C:\\ Program Files文件(x86)的\\的Windows套件\\ 8.1 \\ LIB \\ winv6.3 \\恩\\ 64

P.S. If you don't find psapi.lib anywhere, it's because you don't have the Windows SDK. I installed both Windows 7 and Windows 8 SDKs and eventually had the psapi.lib located here C:\Program Files (x86)\Windows Kits\8.1\Lib\winv6.3\um\x64

编辑:
为了让您的最新错误的解决方案以某种通用的方式,每当 NMAKE 抛出没有这样的文件错误,该文件的位置不是在 common-VC9.mk 文件正确引用。

To give you a solution for your newest errors in a somewhat general way, whenever nmake throws "No such file" errors, the location for the file is not properly referenced in common-VC9.mk file.

有两种类型的文件 NMAKE 将寻找: .H 。 LIB

There are two types of files nmake will look for: .h or .lib.

如果一个 .H 是找不到的,相应的路径应妥善的 CPPFLAGS 变量下引用 common-VC9.mk 文件。
如果的.lib 未找到,则需要相应地更新 LDFLAGS 路径。

If a .h is not found, the corresponding path should be properly referenced under the CPPFLAGS variable of common-VC9.mk file. If a .lib is not found, you need to update LDFLAGS path accordingly.

如何?用同样的方法包括了 psapi.lib 的路径:找到该文件,并追加到适当的变量相应的路径: CPPFLAGS LDFLAGS

How? The same way you included the path for psapi.lib: locate the file and append the corresponding path to the proper variable: CPPFLAGS or LDFLAGS.

这篇关于与Python 2.7的Windows 64位安装的mod_wsgi的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆