简体   繁体   中英

Linux Mint Changing current version of Python

I have installed python 3.7 but still using and showing version of python 2.7 . I want to change it to 3.. I searched it but ı can't did it.

You should not change your syslink python to use python 3 because it is most likely that your system is using that syslink to python 2 for its own tasks and processes, if you change that, you may broke your system.

As Sammy said in a comment, you should use python3 to use that version.

On the pip side, it is probably that your python 3 does not have pip include (it should have it, but I have seen a lot of Python 3 without it). You can check if you have pip doing: python3 -m pip . The -m param is used to execute modules of python installed.

If you do not have pip installed , you can install it following this (which I recommend because always work): https://pip.pypa.io/en/stable/installing/

That is:

  • Download a script to install pip: curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
  • Execute the script in order to install pip (with sudo because you're going to modify your system): sudo python3 get-pip.py

Now you should have pip installed and doing python3 -m pip again should show you the help of pip.

If you have pip already installed and no pip3 command in your system, you can always create an alias to python3 -m pip with the name pip3 and problem solved. Also if you don't know or do not want to create alias or executables in the /usr/bin folder, you can always keep using python3 -m pip .

PS: It is highly recommended to use virtualenvs when developing with python. If you do not know what it is, here it is a link to the docs: https://virtualenv.pypa.io/en/latest/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM