如何使用 Anaconda Python 来执行 .py 文件? 您所在的位置:网站首页 linux使用anaconda环境py 如何使用 Anaconda Python 来执行 .py 文件?

如何使用 Anaconda Python 来执行 .py 文件?

2023-11-20 23:12| 来源: 网络整理| 查看: 265

百度翻译此文   有道翻译此文 问题描述

I just downloaded and installed Anaconda on my Windows computer. However, I am having trouble executing .py files using the command prompt. How can I get my computer to understand that the python.exe application is in the Anaconda folder so it can execute my .py files?

推荐答案

You should use Anaconda Prompt instead of common Windows command prompt. Then navigate to your folder with the .py file and run:

python myfile.py

However if you want to use normal command prompt you should put the path with you're python.exe which is usually in

C:\Users\\AppData\Local\Continuum\anaconda3\python.exe

behind this one put your .py file.

其他推荐答案

Launch JupyterLab from Anaconda (Perform the following operation with JupyterLab ...)

Click on icon folder in side menu

Start up "Text File"

Rename untitle.txt to untitle.py (The name of the file started up was also changed)

Start up the "terminal" (In windows the power shell starts up)

Execute the command python untitle.py

其他推荐答案

Right click on a .py file and choose 'open with'

Scroll down through the list of applications and click something like 'use a different program'

Naviage to C:\Users\\AppData\Local\Continuum\anaconda3

click on python.exe and then click on 'ok' or 'open'

Now when you double click on any .py file it will run it through Anaconda's interpreter and therefore run the python code.

I presume if you run it through the command line the same would apply but perhaps someone could correct me?



【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有