#πŸ”’ Is there a way to execute commands in anaconda prompt via a python script?

18 messages Β· Page 1 of 1 (latest)

teal heath
#

I'm aware that the os library allows you to execute commands via the command prompt, but I need to use anaconda prompt, not the regular command prompt. Is there a way of doing that?

tawdry steppeBOT
#

@teal heath

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

visual bison
#

subprocess.Popen should be able do it, but you will have to find the executable path and may need to set some environment variables and/or command line arguments

teal heath
#

Wdym?

sharp geyser
#

what do you mean by anaconda prompt?

small aurora
teal heath
small aurora
small aurora
sharp geyser
#

so with the anaconda virtual env activated?

#

shell=True will likely not do what OP wants.

small aurora
#

ye maybe sorry πŸ˜„

teal heath
#

I'm basically trying to make a quick script that will open an environment I made and use the cd command a few times so I don't need to manually do it every time.

sharp geyser
#

uh. that's probably better done with a shell script (.ps1 or so?), instead of python.

teal heath
#

Noted

tawdry steppeBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.