python compile | compile py|xp python|python library |python ssl|python.exe|python|python socket
In actual development, we often need to python A component or support program compiled into our program , So we need to compile one by ourselves python Interpreter .
py Is an open source interpretation language , We can easily download its source code :
python Official website :http://Python Source download
If you need to compile py Can be in xp Up operation , Latest supportable xp Of python Version is Python 3.4.4.
Here you can set the generation platform , For example, compatibility is required xp. It can be set to 141xp
The generated python_d.exe、python27_d.dll Put the files on one computer py Computers in the environment , Simple execution python -V test
To write pytest.py
print("hello word")
perform py file , Not output normally
The above figure is not implemented successfully , Because now we have py Interpreter , however py The standard library file for does not exist , So the library function call failed .
Find in the source directory Lib Catalog , Copy it to the... Of the experimental machine python2.7.exe Under the table of contents
Execute again after copying to the target location py Program , Results the correct .
Continued above , So we happily carry out some py Program
There was a mistake again , go through Lib No... Was found in the folder _socket Wait for the documents .
go back to py Source code , See if there are similar words
See light suddenly ,py Apart from the encapsulated logic library . The underlying communication library must be related to the operating system api dependent .
Compile the library to generate the corresponding library file , The suffix is pyd. Put it in DLLs Catalog .
There is no error in the previously missing library . Compile all libraries into DLLs Folder is ok .
Compile here ssl After the pyd Put the library file into DLLs, Try running again .
be relative to py The file is , Translate it into pyc and pyo In essence, py There's no big difference , Only for this module loading speed increased , It doesn't speed up code execution , In general, you don't need to actively compile pyc file , The document says that just call import model that model.py It will be compiled into pyc Then load .
compile openssl We need to pay attention to
Available tutorials :windows compile openssl
openssl Source code :oepnssl Source download
Pit avoidance point :
1、Perl Own Baidu , Go to the next one on the official website win Just set the environment variables on the installation version .
2、 After compilation _ssl The dependency library is set to ssleay.lib, The project itself seems to be crypt.lib.