Visual Studio code does not see wget

I have Python 2.7 installed on my machine. I use it in Visual Studio Code (VSC) (MacOS distribution) without problems, but it's hard for me to get Visual Studio code to β€œsee” wget .

In my VSC, I added the following import statement to myProject.py :

 import wget 

Linter says this:

E0401: Unable to import 'wget'

I confirmed that I have wget installed with the following command:

 which wget 

... which returns ...

 /usr/local/bin/wget 

I tried reinstalling it with brew install wget , but it says it is already installed. So I tried sudo -H pip install wget , which I think was successfully installed.

Collecting wget Downloading wget-3.2.zip Creating wheels for assembled packages: wget Running setup.py bdist_wheel for wget ... done Saved in: / Var / Root / Library / cache / pip / wheel / 6d / 98/29 / 61ccc41148f871009126c2e844e26f73eeb25e12cca92228a522 Successfully built wget Installing compiled packages: wget Successfully installed wget-3.2

I closed VSC and reopened it. I keep getting this error in linter:

E0401: Unable to import 'wget'

I recently installed and uninstalled anaconda , and I am sure that this is the source of my suffering. I do not regularly work with Python, but I believe that I am working on a project where it is quite convenient. I have no ideas: how to solve this problem. I welcome your suggestions, and I thank you for reading.

Update:

This question describes the problem I am facing. I tried the suggested solutions, and none of them seemed to save me from the linter error.

Updating my .bash_profile will have no effect:

 export PYTHONPATH=$PYTHONPATH:/usr/local/lib/python2.7/site-packages 
+5
source share
1 answer

I am having a problem with my Python installation. I'm not sure what it was and why, since the other packages I installed worked fine ( matplotlib , etc.).

Here is how I resolved it:

I removed python via home-brew as follows:

brew uninstall python

Then I reinstalled python via brew as follows:

brew install python

I opened my .bash_profile with the following command in the terminal:

open .bash_profile

I commented on the path to this path and added it (do not keep the path unless you are sure that you do not need it):

export PATH="/usr/local/opt/python/libexec/bin:$PATH"

I then followed brew prompts to complete the installation. Upon completion, I installed wget via pip2 as follows:

 pip2 install wget 

After that, I opened the Visual Studio code, typed import wget , and it worked.

+3
source

Source: https://habr.com/ru/post/1275371/


All Articles