ArcGIS Desktop and ArcGIS Server should always be the software prerequisites when you install ArcGIS
But they use a different Python, the desktop uses 32 bits, and the server uses 64 bits.
In order for the map document generated by arcpy to be published to Server,python interpreter be sure to use 64-bit, if it is a 32-bit environment, there are two situations:
arcpy Other features no problem, upload blocking occurs when you publish an MXD
Calling arcpy will show that the DLL is not a valid Win32 execution program, such as an error
The solution to the problems encountered before is as follows:
Configure system environment variables, PYTHONPATH, point to three directories agsserver/arcpy,agsserver/bin,agsserver/arctoolbox/scripts (Agsserver is ArcGIS Server's installation directory)
Using 64-bit Apache, the official only 32-bit installation package, recommended to download here
WSGI also use 64-bit,
In the portal Py must add the three paths mentioned in the first step to Sys.path
Publishing Web Services using arcpy under Windows AMD64 Environment