简体   繁体   中英

Visual Studio Code keeps throwing an unresolved import error for two module imports

I keep receiving an "unresolved import" error for a series of modules that my project relies on.

I've tried implementing the recommendations offered in the following two articles: https://code.visualstudio.com/docs/python/environments#_environment-variable-definitions-file Visual Studio Code - How to add multiple paths to python path?

In particular, I created a ".env" file in my VS Code workspace; the file has the following contents: "PYTHONPATH": "c:\\pct\\pct-primary-internet-website\\wagtail-src\\wagtail"

My application code is in "c:\\pct" however the module that VS Code is unable to find is located in the following directory: C:\\PCT\\pct-primary-internet-website\\wagtail-src\\wagtail

It looks like you wrote your .env file using JSON syntax versus the syntax the file expects. Try:

PYTHONPATH=c:\pct\pct-primary-internet-website\wagtail-src\wagtail

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM