在运行程序之前,我必须在终端中执行以下代码,如下所示:
(venv) C:\Users\user pc\PycharmProjects\testProj>pip install -U pip --user
Requirement already up-to-date: pip in c:\users\user pc\pycharmprojects\testproj\venv\lib\site-packages (19.0.3)
(venv) C:\Users\user pc\PycharmProjects\testProj>pip install psycopg2 --user
Requirement already satisfied: psycopg2 in c:\users\user pc\pycharmprojects\testproj\venv\lib\site-packages (2.7.7)
好的,pip已经被安装。 只有在运行了这个之后,我才需要运行我的程序,在程序中出现了以下错误:
"C:\Users\user pc\PycharmProjects\testProj\venv\Scripts\python.exe" "C:/Users/user pc/PycharmProjects/testProj/auto.py"
The unique id is 1
Traceback (most recent call last):
File "C:/Users/user pc/PycharmProjects/testProj/auto.py", line 381, in <module>
p = subprocess.Popen(["dscsm047.exe"], stdout=subprocess.PIPE, stdin=subprocess.PIPE)
File "C:\Users\user pc\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 775, in __init__
restore_signals, start_new_session)
File "C:\Users\user pc\AppData\Local\Programs\Python\Python37-32\lib\subprocess.py", line 1178, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
Process finished with exit code 1
您能否更加清晰明确地说明调试此错误的过程,因为我对这个编程领域非常陌生。
dscsm047.exe
。在你的终端/cmd中输入echo %PATH%
来查看PATH变量。 - gdlmx(venv) C:\Users\user pc\PycharmProjects\testProj>echo %PATH% C:\Users\user pc\PycharmProjects\testProj\venv\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Hexagon\ERDAS IMA GINE 2015\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Hexagon\ERDAS IMAGINE 2015\;C:\Users\user pc\AppData\Local\Pr ograms\Python\Python37-32\Scripts\;C:\Users\user pc\AppData\Local\Programs\Python\Python37-32\;C:\Python34\Scripts
- user11108368