简体   繁体   中英

Adding a directory to PATH in visual studio

I'm trying to add a bunch of libraries to python while using visual studio. I downloaded python using the microsoft store, but have downloaded everything else using pip, which doesn't download to the same place. How do I adjust the path, or where do I need to move files to ensure that I can import everything properly?

Open workspace Settings.json, add

"python.analysis.extraPaths": [
    "\the folder that contains modules\",
]

Then in python file, before importing modules, add

import sys
sys.path.append("\the folder that contains modules\")

See the following picture, there's no discord in current interpreter and with above settings and code, it can be import successfully. Please have a try. 在此处输入图片说明

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