我有一个问题:我需要在python脚本中执行.exe。 (此exe是使用VS编译的,使用的DLL也位于当前文件夹中,我可以直接在cmd中运行。)我搜索到可以在线使用os. system ()
和subprocess. call ()
,但它们都不能这些错误日志:
import subprocess
subprocess.call("BuildingTextureRDF.exe ./data/fujiaju_cycle.csv ./data/test.csv ./data/result_csv/114.374041130.449
92626.csv 0 3 4 5 1 2 -1 3.0 8 50.0 1000.0 1")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "F:\Users\hp\Anaconda3\lib\subprocess.py", line 267, in call
with Popen(*popenargs, **kwargs) as p:
File "F:\Users\hp\Anaconda3\lib\subprocess.py", line 709, in __init__
restore_signals, start_new_session)
File "F:\Users\hp\Anaconda3\lib\subprocess.py", line 997, in _execute_child
startupinfo)
OSError:[WinError 193] %1 is not a valid Win32 application
我的python信息:
Python 3.6.3 |Anaconda custom (64-bit)| (default, Oct 15 2017, 03:27:45) [MSC v.1900 64 bit (AMD64)] on win32
所以我需要更改python版本吗?
如果我使用os.system():
os.system("BuildingTextureRDF.exe ./data/fujiaju_cycle.csv ./data/test.csv ./data/result_csv/114.374041130.44992626.
csv 0 3 4 5 1 2 -1 3.0 8 50.0 1000.0 1")
它弹出此界面:(图片的一般含义是:
This application cannot run on your computer
To find a version for your computer, consult the software publisher
。)
Deny access.
1
但是,此exe可以直接在cmd中运行
PS H:\Flask> ./urban_texture/BuildingTextureRDF.exe ./urban_texture/data/fujiaju_cycle.csv ./urban_texture/data/test.csv
./urban_texture/data/result_csv/114.374041130.44992626.csv 0 3 4 5 1 2 -1 3.0 8 50.0 1000.0 1
Input Building File: ./urban_texture/data/fujiaju_cycle.csv
Input Lat Lon File: ./urban_texture/data/test.csv
Output Result File: ./urban_texture/data/result_csv/114.374041130.44992626.csv
FID COLUMN = 0
LATITUDE COLUMN = 3
LONGITUDE COLUMN = 4
PER FLOOR AREA COLUMN = 5
FLOORS COUNT COLUMN = 1
BUILDING HEIGHT COLUMN = 2
DEM HEIGHT COLUMN = -1
PER FLOOR HEIGHT = 3
* GEO-HASH SCALE = 8
* STEP RADIUS = 50
* MAXIMUM RADIUS = 1000
* IS NORMAILIZATION = 1
Load lat lon number: 1
2019-01-04 13:46:18 : GeoHash Scale = 8
2019-01-04 13:46:18 : Load file success. Total Number of Buildings = 279.
2019-01-04 13:46:18 : GeoHash Count = 222.
PROCESS FINISH.