I tried this on my personal machine, without the SSH part. However, I will detail how to upload it using scp
to another device, for completeness and ease of use. So, you may encounter some errors in this that I did not. You have been warned.
Step 1: Downloading the psutil
package
On a machine with pip
installed, download the psutil
package using:
pip download psutil
Using ls
(on Linux) we can see we now have a *.tar.gz file in the current directory. At time of writing, the current psutil
version is 5.6.3, so the file name is "psutil-5.6.3.tar.gz"
Step 2: Upload the file to the desired device
Make sure that both you and the destination device are hooked into the same LAN and you know the IP address of the destination device. I will denote this IP address as "W.X.Y.Z".
To upload the file using SSH, run:
scp /path/to/*.tar.gz username@W.X.Y.Z:/desired/path/to/*.tar.gz
If you have the SSH key and want to use that to log in, pass it with the -i
flag:
scp -i /path/to/ssh/key/file /path/to/*.tar.gz username@W.X.Y.Z:/desired/path/to/*.tar.gz
Step 3: SSH into the desired device
This step is pretty straight forward, but I make it it's own step because of how easy it is to get it wrong if you don't know what you are doing.
SSH into the device you uploaded the file to:
ssh username@W.X.Y.Z
If you do not have the SSH key, or it's not where SSH expects it to be, you may need to provide a password.
Step 4: Install the package we just uploaded
Now just install the package!
pip install /path/to/*.tar.gz
If you get an error that says:
ERROR: Cannot uninstall 'psutil'. It is a distutils installed project
and thus we cannot accurately determine which files belong to it which
would lead to only a partial uninstall.
Then you SHOULD already have psutil
installed. You can check this by running:
pip list | grep '^psutil'
On the machine you are trying to install the package on.
EDIT
Also, if your Python script is in Python 3 instead of Python 2 (which it should be since Python 2 End-Of-Life is January 1st 2020), replace everywhere I just used pip
with pip3
.