6

I have Cygwin on Windows10 and now I've installed Ubuntu 20.04 (WSL) and all it seems fine, except for Python3.

I've intalled python3 and pip3 but when I try to use it I get the "bad interpreter" message shown below, and is pointing to the Python3 installed on Cygwin path.

$ python3
Python 3.8.2 (default, Apr 27 2020, 15:53:34)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
$
$ pip3 install pandas
-bash: /mnt/d/d/cygwin64/bin/pip3: /usr/bin/python3.6: bad interpreter: No such file or directory

I've tried to delete/replace symlink as mentioned in this thread like this, but didn't work.

$ sudo rm /usr/bin/python3
$ sudo ln -sf /usr/bin/python3.8 /usr/bin/python3

How to fix this issue? Thanks in advance.

  • 1
    It tries to run /usr/bin/python3.6 (note the 3.6) but You have added symlink to /usr/bin/python3.8 (note 3.8). Maybe just run sudo ln -s /usr/bin/python3.8 /usr/bin/python3.6 ? – Michal Przybylowicz Jun 25 at 15:53
  • Hi Michal, I did in that way because the version 3.6 is the one installed on cygwin. The version 3.8 is the one installed on Ubuntu WSL. – Ger Cas Jun 25 at 16:15
5
  • Why did you type pip3 install pandas instead of python3.8 -m pip install pandas ? python3.8 in this command is the target interpreter.

  • There's no need to use pip to install Pandas in Ubuntu 20.04. The python3-pandas package is in the default Ubuntu 20.04 repositories. To install it type:

    sudo apt update  
    sudo apt install python3.8 python3-pandas
    
| improve this answer | |
  • Thanks for your answer. I tried to install using pip3 install... because I didn't know another way to do it. And I tried what your suggested python3.8 -m pip ... and it worked. Now, I can run any pf both python3.8 -m install package or sudo apt install python3.8 python3-package for any package I want? – Ger Cas Jun 25 at 16:12
  • 1
    Now you can install Python packages with either python3.8 -m pip install package or sudo apt install python3-package for any package you want. Please search for the Python package with apt search package first before you try installing it with pip. Whatever packages you install with apt will also be automatically updated. – karel Jun 25 at 16:15
  • Excellent. Thanks so much for your help. Have a nice day. – Ger Cas Jun 25 at 16:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.