简体   繁体   English

为什么我不能在Pycharm上运行文件?

[英]Why can't i run my file on Pycharm?

I get this error: 我收到此错误:

Error running 'filename.py': Cannot run program "/home/my_name/PycharmProjects/untitled/venv/bin/python" (in directory "/home/my_name/repo_name/ocr"): error=2, No such file or directory 运行“ filename.py”时出错:无法运行程序“ / home / my_name / PycharmProjects / untitled / venv / bin / python”(在目录“ / home / my_name / repo_name / ocr”中):错误= 2,没有此类文件或目录

/home/my_name/PycharmProjects/untitled/file.py is the first file I created after installing PyCharm to make sure it's working then deleted it. /home/my_name/PycharmProjects/untitled/file.py是我在安装PyCharm以确保其正常工作后创建的第一个文件,然后将其删除。

I want to run filename.py which is in ocr but I'm getting the above error. 我想运行ocr filename.py,但出现上述错误。

I tried in the cmd python filename.py and worked just fine, so it's definitely related to PyCharm. 我尝试了cmd python filename.py并正常工作,因此它与PyCharm肯定相关。

How to properly adjust my files once and for all, since I just installed it? 自从我刚刚安装文件后,如何一劳永逸地调整我的文件?

Your error contains this: 您的错误包含以下内容:

Cannot run program "/home/my_name/PycharmProjects/untitled/venv/bin/python"

which indicates, that nothing is wrong with your file, but, instead pycharm cannot locate the python interpreter. 这表明文件没有问题,但是pycharm无法找到python解释器。 It is configured to use a venv one in a project folder "untitled" which, as you said, you deleted. 它配置为在项目文件夹“无标题”中使用venv,正如您所说,该文件夹已删除。 You should choose another interpreter 您应该选择其他口译员

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

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