Home
Sign Up
Sign In
推荐学习书目
›
Learn Python the Hard Way
Python Sites
›
PyPI
- Python Package Index
›
http://diveintopython.org/toc/index.html
›
Pocoo
值得关注的项目
›
PyPy
›
Celery
›
Jinja2
›
Read the Docs
›
gevent
›
pyenv
›
virtualenv
›
Stackless Python
›
Beautiful Soup
›
结巴中文分词
›
Green Unicorn
›
Sentry
›
Shovel
›
Pyflakes
›
pytest
Python 编程
›
pep8 Checker
Styles
›
PEP 8
›
Google Python Style Guide
›
Code Style from The Hitchhiker's Guide
V2EX
›
Python
为什么有的 Python 发行版用 shell 调用 py 文件的时候不能正确传递参数呢?
ljq29
·
May 11, 2019
· 2693 views
This topic created in 2740 days ago, the information mentioned may be changed or developed.
RTRT,楼主安装了 anaconda 的 python,现在用带参数的命令调用 py 文件,执行的时候不能正确获取参数。
程序编写没有问题,因为 py 文件用 pyinstaller 转换成 exe 之后可以正常读取到参数。
参数
Python
调用
文件
8 replies
•
2019-05-11 21:48:02 +08:00
ipwx
May 11, 2019
1
1、你是什么系统。
2、你调用 py 文件的命令行是什么?
一个标准的调用方法(最不容易出错的形式)是 python
aaa.py
参数...
ljq29
OP
May 11, 2019
2
@
ipwx
Windows 系统,命令行类似这样
main.py
upload localhost matlab matlab matlab_folder a.txt
ipwx
May 11, 2019
3
还是上面的论点,先试试 python
main.py
upload localhost matlob matlob matlob_folder a.txt
windows 系统的文件关联很搞,也许你的 .py 在注册表里面关联的执行程序 template 有问题。
ljq29
OP
May 11, 2019
4
@
ipwx
这样就可以了,这是为什么呢?
ljq29
OP
May 11, 2019
5
@
ipwx
另外问一下,如果参数中间有空格怎么解决呢?
aquariumm
May 11, 2019 via Android
6
@
ljq29
双引号
seers
May 11, 2019
7
有点像环境变量问题
ljq29
OP
May 11, 2019
8
@
seers
之前的默认 python 版本是 Lyx 自带的,但是版本有点低。我重装了一遍 anaconda,就成了这个样子。
About
·
Help
·
Advertise
·
Blog
·
API
·
FAQ
·
Privacy
·
Solana
·
950 Online
Highest 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 32ms ·
UTC 20:13
·
PVG 04:13
·
LAX 12:13
·
JFK 15:13
♥ Do have faith in what you're doing.
❯