0

如果直接从命令行启动 python 被识别:

Microsoft Windows [Version 6.3.9600]
(c) 2013 Microsoft Corporation. All rights reserved.

C:\Users\%USER%>conda info --envs
# conda environments:
#
root                  *  C:\Users\%USER%\Miniconda

C:\Users\%USER%>python
Python 2.7.10 |Continuum Analytics, Inc.| (default, May 28 2015, 17:02:00) [MSC
v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://binstar.org
>>> import os
>>> import sys
>>> os.path
<module 'ntpath' from 'C:\Users\%USER%\Miniconda\Lib\ntpath.pyc'>
>>> sys.path
['', 'C:\\Users\\%USER%\\Miniconda\\Lib', 'C:\\Users\\%USER%\\Minico
nda\\python27.zip', 'C:\\Users\\%USER%\\Miniconda\\DLLs', 'C:\\Users\\%USER%\\Miniconda\\lib\\plat-win', 'C:\\Users\\%USER%\\Miniconda\\lib\\l
ib-tk', 'C:\\Users\\%USER%\\Miniconda', 'C:\\Users\\%USER%\\Minicond
a\\lib\\site-packages']
>>>

我有一个 cmd 文件位于:

C:\finished projects\run_aum_insertion.bat

其中包含:

python C:\Users\%USER$\PycharmProjects\upload_acct_value\Main.py

然而,当我运行它时,我收到以下错误:

C:\finished projects>python C:\Users\%USER%\PycharmProjects\upload_acct_va
lue\Main.py
'python' is not recognized as an internal or external command,
operable program or batch file.

C:\finished projects>pause
Press any key to continue . . .

在哪里手动添加了暂停以查看错误。

我的PATH变量如下:

C:\Users\%USER%\Miniconda;C:\Users\%USER%\Miniconda\Scripts;

这对我来说很奇怪,因为 cmd/bat 应该只是我可以直接在命令行中手动执行的任何操作的自动化。

有什么想法吗?

4

0 回答 0