@tensorflow 2 lazy load solution(vs code)
Step by step solution:
Find your tensorflow_core installation (the python package). This is e.g. in ~/.local/lib/python3.6/site-packages, any other site-packages folder you might use (e.g. from virtualenv, pyenv,…)
Create a folder to use for IDE navigation, e.g. ~/.local/virtual-site-packages
Create a symlink in that folder called tensorflow to your tensorflow_core package (mind the name difference, this is intentional!)
Add the path created in the 2nd step to python.autoComplete.extraPaths in VSC (use the full path, i.e. replace your username)
Example for me using pyenv with Python 3.6.9:
mkdir ~/.local/virtual-site-packages
ln -s ~/.pyenv/versions/3.6.9/lib/python3.6/site-packages/tensorflow_core ~/.local/virtual-site-packages/tensorflow
Then use
“python.autoComplete.extraPaths”: [
“/home//.local/virtual-site-packages”
],
可參考:講替換爲用戶名
{
"leetcode.endpoint": "leetcode-cn",
"leetcode.workspaceFolder": "",
"python.condaPath": "/home/<USER>/.conda/envs/tf2/bin",
"python.autoComplete.extraPaths": ["/home/<USER>/.local/virtual-site-packages"],
"window.zoomLevel": 0,
"terminal.integrated.inheritEnv": false,
"python.dataScience.sendSelectionToInteractiveWindow": false
}