Jump to content

Netifaces error in python

SEAL62
Go to solution Solved by Sauron,
3 minutes ago, SEAL62 said:

2.7.18

yep, that was definitely the issue then.

1 minute ago, SEAL62 said:

vscode should use python3. How can I change the default terminal python version?

I would just uninstall python2 if I were you unless you have a specific need for it. Otherwise you can use an alias or specify you want python 3 by using "python3" instead of "python".

Hi everyone,

 

I have a

import netifaces

in my script. It runs without erros in Visual Studio Code and PyCharm.

However when I try to run it from terminal using

python myfile.py

I get the following error

Traceback (most recent call last):
  File "myfile.py", line 1, in <module>
    import netifaces as ni
ImportError: no module named netifaces

Installing netifaces with pip doesn't work as it gives me the result that it is already installed. Uninstall followed by install results in the same above error.

Removing it manually from

/usr/local/lib/python3.9/dist-packages

and reinstalling it afterwards results in the same above error.

 

Thanks in advance

Quote or tag me( @SEAL62 ) if you want me to see your reply

consider a reaction if I was funny, informative, helpful, or agreeable

 

OS: Windows 10 Pro

CPU: Intel i9-9900K GPU: Aorus GeForce RTX 3080 Master Motherboard: Gigabyte Z390 Aorus Master
AIO: Corsair H150i RGB Platinum RAM: Corsair Vengeance RGB Pro 32GB 3000MHz Case: Corsair iCUE 465X RGB PSU: Corsair RM750x White

 

OS: Kali Linux

HP Envy x360 Convertible

CPU: Intel i5-10210U GPU: NVIDIA GeForce MX250 RAM: 16 GB DDR4 2666 SSD: 512GB PCIe

Link to comment
Share on other sites

Link to post
Share on other sites

check what python version your terminal defaults to:

 

python -V

 

it may be different from the one vscode uses

Don't ask to ask, just ask... please 🤨

sudo chmod -R 000 /*

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, Sauron said:

check what python version your terminal defaults to:

 


python -V

 

it may be different from the one vscode uses

2.7.18

Quote or tag me( @SEAL62 ) if you want me to see your reply

consider a reaction if I was funny, informative, helpful, or agreeable

 

OS: Windows 10 Pro

CPU: Intel i9-9900K GPU: Aorus GeForce RTX 3080 Master Motherboard: Gigabyte Z390 Aorus Master
AIO: Corsair H150i RGB Platinum RAM: Corsair Vengeance RGB Pro 32GB 3000MHz Case: Corsair iCUE 465X RGB PSU: Corsair RM750x White

 

OS: Kali Linux

HP Envy x360 Convertible

CPU: Intel i5-10210U GPU: NVIDIA GeForce MX250 RAM: 16 GB DDR4 2666 SSD: 512GB PCIe

Link to comment
Share on other sites

Link to post
Share on other sites

vscode should use python3. How can I change the default terminal python version?

Quote or tag me( @SEAL62 ) if you want me to see your reply

consider a reaction if I was funny, informative, helpful, or agreeable

 

OS: Windows 10 Pro

CPU: Intel i9-9900K GPU: Aorus GeForce RTX 3080 Master Motherboard: Gigabyte Z390 Aorus Master
AIO: Corsair H150i RGB Platinum RAM: Corsair Vengeance RGB Pro 32GB 3000MHz Case: Corsair iCUE 465X RGB PSU: Corsair RM750x White

 

OS: Kali Linux

HP Envy x360 Convertible

CPU: Intel i5-10210U GPU: NVIDIA GeForce MX250 RAM: 16 GB DDR4 2666 SSD: 512GB PCIe

Link to comment
Share on other sites

Link to post
Share on other sites

3 minutes ago, SEAL62 said:

2.7.18

yep, that was definitely the issue then.

1 minute ago, SEAL62 said:

vscode should use python3. How can I change the default terminal python version?

I would just uninstall python2 if I were you unless you have a specific need for it. Otherwise you can use an alias or specify you want python 3 by using "python3" instead of "python".

Don't ask to ask, just ask... please 🤨

sudo chmod -R 000 /*

Link to comment
Share on other sites

Link to post
Share on other sites

3 minutes ago, Sauron said:

yep, that was definitely the issue then.

I would just uninstall python2 if I were you unless you have a specific need for it. Otherwise you can use an alias or specify you want python 3 by using "python3" instead of "python".

specifying it with python3 did the trick. Thank you! 🙂

Quote or tag me( @SEAL62 ) if you want me to see your reply

consider a reaction if I was funny, informative, helpful, or agreeable

 

OS: Windows 10 Pro

CPU: Intel i9-9900K GPU: Aorus GeForce RTX 3080 Master Motherboard: Gigabyte Z390 Aorus Master
AIO: Corsair H150i RGB Platinum RAM: Corsair Vengeance RGB Pro 32GB 3000MHz Case: Corsair iCUE 465X RGB PSU: Corsair RM750x White

 

OS: Kali Linux

HP Envy x360 Convertible

CPU: Intel i5-10210U GPU: NVIDIA GeForce MX250 RAM: 16 GB DDR4 2666 SSD: 512GB PCIe

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×