1

I just installed the new python3 module using terminal of Visual Studio Code on ubuntu.

When I import it, this error occurred.

[Python (analysis)] Unable to resolve 'new module'. IntelliSense may be missing for this module.

But the new module surely installed successfully. (I can import it in my ubuntu terminal)

How can I import that new python module in VS code?

2
  • 1
    Make sure you are using the right interpreter, in the bottom bar you can choose which python you wanna use. If you have mutliple virutal envs you need to choose the right one. EDIT: also, try to reload vscode, maybe it failed at refreshing itself Commented Oct 9, 2018 at 11:17
  • 1
    Ah, I changed my environment from "python 3.6.5 (virtualenv)" to "python 3.6.5-64bit" and It works! Thank you so much!! Commented Oct 9, 2018 at 11:24

1 Answer 1

3

You should look up the official docs on it. They have a neat tutorial to get you started.

Here are a few excerpts that should help you:

An "environment" in Python is the context in which a Python program runs. An environment consists of an interpreter and any number of installed packages. Because many programs are written specifically for a certain Python interpreter and makes use of a set of libraries, developers often create and manage an environment for individual programs.

When working with Python in VS Code, you select from available environments using the Python: Select Interpreter command. The Python extension then uses that selected environment for IntelliSense, auto-completions, linting, formatting, and any other language-related features. (The environment is not, however, used for debugging; see Choose a debugging environment.)

The selected environment is also automatically activated when using the Python: Run Python File in Terminal and Python: Create Terminal commands. Installing (or uninstalling) a package in the Terminal with a command like pip install matplotlib installs (or uninstalls) the package in whatever environment is active in that Terminal.

Note: By default, the Python extension looks for and uses on the first Python interpreter it finds in the system path. If it doesn't find an interpreter, it issues a warning. On macOS, the extension also issues a warning if you're using the OS-installed Python interpreter, because you typically want to use an interpreter you install directly. In either case, you can disable these warnings by setting python.disableInstallationCheck to true in your user settings.

Sign up to request clarification or add additional context in comments.

1 Comment

thank you! I've changed the editor from vim to VS code, so there are some issues with preferences. The links you have recommended have been very helpful to me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.