简体   繁体   English

无法通过“python script.py”从脚本文件夹启动文件

[英]can not start files from scripts-folder via "python script.py"

Der all,都,

I am certain, that this question has been asked.... still i could not find the answer here.我敢肯定,有人问过这个问题……我仍然无法在这里找到答案。

I have a Pyscripts-folder on a my ondrive were some utility scripts are stored.我的驱动器上有一个 Pyscripts 文件夹,其中存储了一些实用程序脚本。 I am on win 10 and my Path and PYTHONPATH seem fine.我在 win 10 上,我的 Path 和 PYTHONPATH 看起来很好。 Currently *.py files are associate with pycharm.目前 *.py 文件与 pycharm 相关联。

If i tpye scriptname.py in to the console and this file is inside my scripts folder it is simply opend by pycharm.如果我将 scriptname.py 输入到控制台并且这个文件在我的脚本文件夹中,它只是由 pycharm 打开。 For various reasons i would like to keep it that way.出于各种原因,我想保持这种状态。

What i do not understand is if i want to excecute the file via :我不明白的是,如果我想通过以下方式执行文件:

python scriptname.py 

than this this file is not found by python, even tho the scripts folder is in my PYTHONPATH?比这个文件没有被python找到,即使脚本文件夹在我的PYTHONPATH中?

help would be appreciated.帮助将不胜感激。

All the best and thank you in advance!祝您一切顺利,在此先感谢您!

pretty strange, I never heard of anything similar to your case in my 3-4 years of programming :p, Check the version of your python by using the python --version command in your console, and check if you're python is using the latest version.很奇怪,在我 3-4 年的编程生涯中,我从未听说过与您的情况类似的任何事情:p,通过在控制台中使用python --version命令检查您的python --version ,并检查您是否正在使用 python最新版本。 If not, then i would recommend you reinstalling Python.如果没有,那么我建议您重新安装 Python。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM