I’m new in this environment and currently learning the basics of Python through YouTube courses. While using VSCode, I always encounter the same problem when I try to use the terminal. The command (like a pip install for ex) won’t run because my users folder name has a space in it.
It shows "C:User<my first name> " is not valid.
Otherwise when I run code with CodeRunner everything works fine.
I’m sorry to not adjoint a screenshot to it it seems I’m not able to.
Is there anyway to fix this?
Question posted in Visual Studio Code
View the official documentation.
View the official documentation.
3
Answers
You can run the command using quotes.
It’d go something like:
Using quotes should solve your issue. Cheers!
People will probably say:
If you’re running the commands in the terminal, put quotes around the path. E.g.,
python "path/to/spaced file.py"
.Otherwise, if this is a task that you’re running, simply put
""
around${file}
intasks.json
.Though, I strongly recommend not using spaces, and replacing with something like
-
or_
, or just a capitalisation rule likecamelCase
orPascalCase
.If you have successfully set the environment variables and selected the correct interpreter. Then using the
pip
command directly in the terminal to install the package will not cause an error.If you cannot avoid using folder names that contain spaces, you can install the package in a terminal using a command in a format similar to the one below.
just an example