How to set vs code for python3
I recently bought a new laptop and installed ubuntu. I messed around with bash and learned that I there is a default python interpreter. However, the biggest problem that I face is that I can't get it to import pygame, a neat package that I've used in some projects. python3 gives me "ModuleNotFoundError: No module named 'pygame'".
I've scoured around the Internet to find a meaningful solution but only came across someone mentioning /usr/bin/python3. I used it on terminal and did not produce any errors. I couldn't get what the rest of the post was saying because it turned too technical for me (My knowledge in programming is very limited as you have guessed).
Ultimately, what I want is for my vs code to execute python3 without giving errors on the import lines. Or at the very least, I need to be able to run a script in terminal without any preliminary errors so I can debug my own code peacefully. It is also giving me a weird error saying that I don't have pip, again, I already got it installed with:
sudo apt-get install python-pip
Or something similar to it.
EDIT As pointed out by Kumpel Gras, The root of my problems was that I had only installed pip instead of pip3. I managed to get things working after installing python3-pip
bash python python3 visual-studio-code
add a comment |
I recently bought a new laptop and installed ubuntu. I messed around with bash and learned that I there is a default python interpreter. However, the biggest problem that I face is that I can't get it to import pygame, a neat package that I've used in some projects. python3 gives me "ModuleNotFoundError: No module named 'pygame'".
I've scoured around the Internet to find a meaningful solution but only came across someone mentioning /usr/bin/python3. I used it on terminal and did not produce any errors. I couldn't get what the rest of the post was saying because it turned too technical for me (My knowledge in programming is very limited as you have guessed).
Ultimately, what I want is for my vs code to execute python3 without giving errors on the import lines. Or at the very least, I need to be able to run a script in terminal without any preliminary errors so I can debug my own code peacefully. It is also giving me a weird error saying that I don't have pip, again, I already got it installed with:
sudo apt-get install python-pip
Or something similar to it.
EDIT As pointed out by Kumpel Gras, The root of my problems was that I had only installed pip instead of pip3. I managed to get things working after installing python3-pip
bash python python3 visual-studio-code
You should tell us your release of Ubuntu. Ubuntu has been moving away from python 2 (to Python 3) so there are slight differences depending on your Ubuntu release. wiki.ubuntu.com/Python
– guiverc
Feb 10 at 10:56
add a comment |
I recently bought a new laptop and installed ubuntu. I messed around with bash and learned that I there is a default python interpreter. However, the biggest problem that I face is that I can't get it to import pygame, a neat package that I've used in some projects. python3 gives me "ModuleNotFoundError: No module named 'pygame'".
I've scoured around the Internet to find a meaningful solution but only came across someone mentioning /usr/bin/python3. I used it on terminal and did not produce any errors. I couldn't get what the rest of the post was saying because it turned too technical for me (My knowledge in programming is very limited as you have guessed).
Ultimately, what I want is for my vs code to execute python3 without giving errors on the import lines. Or at the very least, I need to be able to run a script in terminal without any preliminary errors so I can debug my own code peacefully. It is also giving me a weird error saying that I don't have pip, again, I already got it installed with:
sudo apt-get install python-pip
Or something similar to it.
EDIT As pointed out by Kumpel Gras, The root of my problems was that I had only installed pip instead of pip3. I managed to get things working after installing python3-pip
bash python python3 visual-studio-code
I recently bought a new laptop and installed ubuntu. I messed around with bash and learned that I there is a default python interpreter. However, the biggest problem that I face is that I can't get it to import pygame, a neat package that I've used in some projects. python3 gives me "ModuleNotFoundError: No module named 'pygame'".
I've scoured around the Internet to find a meaningful solution but only came across someone mentioning /usr/bin/python3. I used it on terminal and did not produce any errors. I couldn't get what the rest of the post was saying because it turned too technical for me (My knowledge in programming is very limited as you have guessed).
Ultimately, what I want is for my vs code to execute python3 without giving errors on the import lines. Or at the very least, I need to be able to run a script in terminal without any preliminary errors so I can debug my own code peacefully. It is also giving me a weird error saying that I don't have pip, again, I already got it installed with:
sudo apt-get install python-pip
Or something similar to it.
EDIT As pointed out by Kumpel Gras, The root of my problems was that I had only installed pip instead of pip3. I managed to get things working after installing python3-pip
bash python python3 visual-studio-code
bash python python3 visual-studio-code
edited Feb 10 at 11:08
Silver Flash
asked Feb 10 at 10:41
Silver FlashSilver Flash
655
655
You should tell us your release of Ubuntu. Ubuntu has been moving away from python 2 (to Python 3) so there are slight differences depending on your Ubuntu release. wiki.ubuntu.com/Python
– guiverc
Feb 10 at 10:56
add a comment |
You should tell us your release of Ubuntu. Ubuntu has been moving away from python 2 (to Python 3) so there are slight differences depending on your Ubuntu release. wiki.ubuntu.com/Python
– guiverc
Feb 10 at 10:56
You should tell us your release of Ubuntu. Ubuntu has been moving away from python 2 (to Python 3) so there are slight differences depending on your Ubuntu release. wiki.ubuntu.com/Python
– guiverc
Feb 10 at 10:56
You should tell us your release of Ubuntu. Ubuntu has been moving away from python 2 (to Python 3) so there are slight differences depending on your Ubuntu release. wiki.ubuntu.com/Python
– guiverc
Feb 10 at 10:56
add a comment |
1 Answer
1
active
oldest
votes
python-pip
is the package for Python 2.
You need to install python3-pip
and then use pip3
to install your Python 3 modules.
If you want to run your Python 3 code from the command line you also have to use python3
, as just python
is usually linked to Python 2. You can check for the python version using python --version
or also pip --version
.
Yeah, apparently that has been my problem all along. Installing pip3 suddenly solved all my problems. Thank you!
– Silver Flash
Feb 10 at 11:02
@SilverFlash If you found this answer helpful and it solved your problem, you can mark this answer as accepted by clicking on ✔️
– Kulfy
Feb 10 at 16:38
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1117101%2fhow-to-set-vs-code-for-python3%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
python-pip
is the package for Python 2.
You need to install python3-pip
and then use pip3
to install your Python 3 modules.
If you want to run your Python 3 code from the command line you also have to use python3
, as just python
is usually linked to Python 2. You can check for the python version using python --version
or also pip --version
.
Yeah, apparently that has been my problem all along. Installing pip3 suddenly solved all my problems. Thank you!
– Silver Flash
Feb 10 at 11:02
@SilverFlash If you found this answer helpful and it solved your problem, you can mark this answer as accepted by clicking on ✔️
– Kulfy
Feb 10 at 16:38
add a comment |
python-pip
is the package for Python 2.
You need to install python3-pip
and then use pip3
to install your Python 3 modules.
If you want to run your Python 3 code from the command line you also have to use python3
, as just python
is usually linked to Python 2. You can check for the python version using python --version
or also pip --version
.
Yeah, apparently that has been my problem all along. Installing pip3 suddenly solved all my problems. Thank you!
– Silver Flash
Feb 10 at 11:02
@SilverFlash If you found this answer helpful and it solved your problem, you can mark this answer as accepted by clicking on ✔️
– Kulfy
Feb 10 at 16:38
add a comment |
python-pip
is the package for Python 2.
You need to install python3-pip
and then use pip3
to install your Python 3 modules.
If you want to run your Python 3 code from the command line you also have to use python3
, as just python
is usually linked to Python 2. You can check for the python version using python --version
or also pip --version
.
python-pip
is the package for Python 2.
You need to install python3-pip
and then use pip3
to install your Python 3 modules.
If you want to run your Python 3 code from the command line you also have to use python3
, as just python
is usually linked to Python 2. You can check for the python version using python --version
or also pip --version
.
edited Feb 10 at 10:59
answered Feb 10 at 10:51
Kumpel GrasKumpel Gras
265
265
Yeah, apparently that has been my problem all along. Installing pip3 suddenly solved all my problems. Thank you!
– Silver Flash
Feb 10 at 11:02
@SilverFlash If you found this answer helpful and it solved your problem, you can mark this answer as accepted by clicking on ✔️
– Kulfy
Feb 10 at 16:38
add a comment |
Yeah, apparently that has been my problem all along. Installing pip3 suddenly solved all my problems. Thank you!
– Silver Flash
Feb 10 at 11:02
@SilverFlash If you found this answer helpful and it solved your problem, you can mark this answer as accepted by clicking on ✔️
– Kulfy
Feb 10 at 16:38
Yeah, apparently that has been my problem all along. Installing pip3 suddenly solved all my problems. Thank you!
– Silver Flash
Feb 10 at 11:02
Yeah, apparently that has been my problem all along. Installing pip3 suddenly solved all my problems. Thank you!
– Silver Flash
Feb 10 at 11:02
@SilverFlash If you found this answer helpful and it solved your problem, you can mark this answer as accepted by clicking on ✔️
– Kulfy
Feb 10 at 16:38
@SilverFlash If you found this answer helpful and it solved your problem, you can mark this answer as accepted by clicking on ✔️
– Kulfy
Feb 10 at 16:38
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1117101%2fhow-to-set-vs-code-for-python3%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You should tell us your release of Ubuntu. Ubuntu has been moving away from python 2 (to Python 3) so there are slight differences depending on your Ubuntu release. wiki.ubuntu.com/Python
– guiverc
Feb 10 at 10:56