简体   繁体   中英

I've installed python-3.9.1 and pip but while running the command python3 -V got the result as python 3.6.9 how do I get python version 3.9

sudo apt-get install python3.7

Reading package lists... Done

Building dependency tree

Reading state information... Done

python3.7 is already the newest version (3.7.10-1+bionic2).

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

N: Ignoring file 'security' in directory '/etc/apt/sources.list.d/' as it has no filename extension root@ubuntu:~# python3 -V Python 3.6.9

I presume you are a Linux user. I faced a similar issue when I was trying to install Python 3.9 but when I ran python -V in the terminal, it would tell me I had version 2. I can't guarantee

this will work but it worked for me. If you are using Ubuntu 20.04 a Linux distro, by default you have Python 3.9. In Ubuntu 18 and 16 there is also a Python version pre-installed. In your case, you need to first uninstall Python 3. Using this command in the terminal.

sudo apt-get remove --purge python3

After uninstalling, reinstall as Python 3.9 version using this command:

sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python3.9
python3.9 --version

Again if you're using an editor like Pycharm your base interpreter will be messed up. So please be careful when uninstalling. And this code works on Ubuntu which I presume is what you are working on. Another thing you need to install a repository to get Py 3.9. it's called deadsnakes I've mentioned the code above on how you could install it. I hope you faced no issues. Remember it worked for me but I'm not sure it will work for you. Enjoy with Python 3.9 if the installation is successful:)

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