简体   繁体   中英

LoadLibrary: The specified procedure could not be found

I need to extract some things about system process in a windows 2003 server (yeah, in 2019), I made that code in python, and compiled it with auto_py_to_exe

When I run the .exe file on the server, I recevbe an error saying "LoadLibrary: The specified procedure could not be found." referring to python37.dll

I try to compile like one directory (with the specific dll included), and I try to compile like one file, and I get the following output .

There'a too big gap between Python 3.7 and Win 2003 . Looking at [Python.Wiki]: WindowsCompilers Python 3.7 is not even listed there (as it's built with VStudio 2017 ). That, (and Python itself) will require / call functions that are not present in Win 2003 system .dll s.

Here's an example. In the images below I opened 2 versions' ( 2.7 and 3.7 ) main .dll with Dependency Walker :

图0

As seen, both import a bunch of functions from kernel32.dll . But one difference is that python37.dll imports GetTickCount64 . According to [MS.Docs]: GetTickCount64 function , the minimum Server version that supports it is Win 2008 , meaning that it won't work in Win 2003 .

So, you'd have to go way back to python 2.7 (tops). A number of years ago, I've built Python 2.7.10 with VStudio 2010 and it worked on Win 2003 (and XP SP 1 ); most likely, this also applies to the newest ( 2.7 ) version.

Note that you'll also have to install all the packages that you use in your script (including auto-py-to-exe ).

@EDIT0 :

I remembered (and just checked) that I have Python 3.4.3 on my XP ( SP 3 ) PC . So, there's high chance that Python 3 (prior to 3.5 ) will work on Win 2003 as well.

@EDIT1 :

Finally, I have some official statement: On Python official page, hovering the mouse over the " Download " button yields:

Note that Python 3.5+ cannot be used on Windows XP or earlier.

or (even clearer):

图1

Note that it doesn't necessarily mean that older versions are guaranteed to work. So, you'll need to do a bit of testing (I'd recommend installing Python and required packages on the target machine, and only when everything is successful, package everything).

@EDIT2 :

I mentioned that I've built a Python2.7 version. psutil was part of it.

 >>> import sys, platform, psutil >>> sys.version, sys.platform ('2.7.10 (default, Mar 8 2016, 15:08:43) [MSC v.1600 32 bit (Intel)]', 'win32') >>> platform.platform() 'Windows-XP-5.1.2600-SP3' >>> psutil.__version__ '3.1.1' 

I didn't mention that I've built psutil from sources, but the prebuilt .whl s and also Win installers are available for download: [PyPI]: psutil 3.1.1 - Download files .

最后我使用了python 2.7.9和py2exe,它解决了,但是PSutil不兼容Windows 2003 Server:c

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM