Jetson Nano 2gb: update packages

Hi, all

I’ve successfully done all steps from Getting Started Guide for Jetson Nanon 2 gb (Getting Started with Jetson Nano 2GB Developer Kit | NVIDIA Developer). However, I found out that by default there is python 2.7 installed. How can I update it to python 3.x and install pytorch? Thank you

You might have both versions of Python, but the version 2 is probably first in the search path. For example, type “which python”, then “ls -l /usr/bin/python” (I am guessing it is located there, adjust for what “which” returns), and it probably is a symbolic link to “/usr/bin/python2.7”. You might look to see which versions are available already via “ls /usr/bin/python*”.

If version 3 is missing, search like this (FYI, “less” is a pager which lets you scroll forward and back and search…just use “q” to quit when done):
apt search python3 | less

To search for “python3...” at the start of a line in “less”:

You will find there is a package named “python3”, and you can install it like this if you don’t already have it:
sudo apt-get install python3

Incidentally, you can check for different releases like this, where the least detailed version will be a symbolic link, and eventually you get to the most detailed release version as the actual file. Try this:

which python
which python2
which python2.7
which python3

You can install both version 2 and 3 at the same time without issue. You might still find out you need to install the correct version of pip, but you will see a message if you run into that need. In the same way you might have pip, pip2, or pip3.

Instead of just typing “python”, you can specifically type “python2” or “python3”. If you happen to have multiple version of something like python3, but one in “/usr/bin/python3” and another in “/usr/local/bin/python3”, you can name the full path and get that exact file, for example:

/usr/bin/python3 --version
/usr/bin/python2 --version
python --version

At the top of python files you will see a comment (at least most of such files), called the “shebang”, and if no specific python interpreter is named, then this is what the fie will use:

If you edit this to name a particular version, then it uses that:

Incidentally, if you want the symbolic link “/usr/bin/python” to point to python3 instead of python2, then you could do this (avoid doing this though if you don’t have a good reason for it):

cd /usr/bin
sudo ln -sf ./python3 python

Most of the time this is equivalent, but under some circumstances may differ:

cd /usr/bin
sudo ln -sf /usr/bin/python3 python

If you run into other issues feel free to ask, but someone else will need to answer questions specific to pytorch.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.