Reputation: 37
the title explain's the problem, the module is tensorflow, recently i had the same issue with numpy also, but adding my site-packages path to vscode python->autoComplete->extraPaths
fixed the problem in case of numpy, but it doesn't work for tensorflow!
now let me tell you what i mean by PROPERLY:
when i write a dot(.) after module name and then press CTRL + SPACE
it shows nothing to me but when i type the first letter it starts showing attributes.
it's not such a big deal but i just feel want it fixed, and i want to know the reason behind it to prevent such things again.
also my extraPaths in setting.json:
{"python.autoComplete.extraPaths": [
"/home/shayan/.local/lib/python3.10/site-packages/keras",
"/home/shayan/.local/lib/python3.10/site-packages/tensorflow/",
"/lib/python3.10/site-packages/keras",
"/home/shayan/.local/lib/python3.10/site-packages/keras",
"/usr/lib/python3.10/site-packages",
"/home/shayan/.local/lib/python3.10/site-packages",
"/home/shayan/.local/lib/python3.10/site-packages/numpy",
"/usr/lib/python3.10/site-packages/tensorflow",
"/home/shayan/.local/lib/python3.10/site-packages/tensorflow",
]
}
Upvotes: 2
Views: 1704
Reputation: 9727
The reason for all this is probably because you have multiple python versions on your machine, which messes up the vscode environment.
It is recommended that you use a virtual environment, which is very helpful for using different python versions and installing different packages in different environments.
How to create and use a virtual environment:
Create a virtual environment named .venv using the following command in the vscode terminal
python -m venv .venv
Activate the virtual environment with the following command
.venv\scripts\activate
PS: Select the python interpreter in the virtual environment, and then create a new terminal, the virtual environment will be automatically activated.
Upvotes: 0