Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Machine Learning Machine Learning Basics Writing a Classifier Loading a Dataset

Am I writing the cmd line correctly? I am trying to open a .py file with Anaconda..

I'm trying to open a .py file with Anaconda, as shown in the Machine Learning video but I can't figure out why it cannot find the path I'm putting in.

This is my cmd prompt and I know that the .py file is in the machine learning folder. Do I need to do '...' before or what? I am lost!

Steven Parker
Steven Parker
231,269 Points

I'm not able to see the image, but you should be able to reproduce a command just by typing it here.

Steven Parker

When I go to 'environments' and then open the base with terminal, it wants me to type the path of the file I want to open. So this is what I gave it.

(base) C:\Users\Luka>cd ~/Python/Projects/treehouse/machine_learning/ml.py

And then it says, "The system cannot find the path specified."

Even when I go to my documents and see where the file is the path is Luka > Python > Projects > treehouse > machine_learning > ml.py

So I'm not sure what I'm doing wrong, or an alternative to opening a Python file on Anaconda without the cmd. I tried researching it but couldn't find anything that could help me out.

P.S Thanks for being the best person in the community!! You always somehow answer my questions when nobody else does. Cheers!

Steven Parker

I copied and pasted both of those and I still get the same message. Can I move the file somewhere else where it can definitely find it?

Steven Parker

You fixed it! Thanks so much, man, I learned something new today :D

After this ML course I think I'm going to go take the terminal course lol

1 Answer

Steven Parker
Steven Parker
231,269 Points

The "cd" command is only for directories, but this path is to a Python file. Also, I noticed that your prompt has backslashes instead of slashes — so you probably need Windows-style backslashes for separators instead of the Linux style slashes used in the workspaces:

So if you want to change the working directory, use just the directory part of the path:

cd Python\Projects\treehouse\machine_learning

Or, if you want to open the file from where you are:

Python Python\Projects\treehouse\machine_learning\ml.py

I also eliminated the "~/" prefix since you are already in a folder along the path.