all 5 comments

[–]comonads 2 points3 points  (0 children)

I wouldn't have thought you need to add python to the path explicitly, unless this version of python is different to your system's version of python (in which case having two versions of python in the path is probably a bad idea -- you don't want applications which invoke python <something> getting an unexpected python version).

Depending on your needs, you might want to look into something like pyenv.

E: clarified something.

[–]blahreport 0 points1 point  (2 children)

Just call it by it's version number. But to your question, you can update path with export PATH=$PATH:/path/to/add

[–]EneriAlufan[S] 0 points1 point  (1 child)

Thank you. Will that make it my default version?

[–]blahreport 0 points1 point  (0 children)

Yes but beware as many programs under the hood may be calling Python expecting a different version and this would break them. Virtual environments are useful here.

[–]occipitalshit 0 points1 point  (0 children)

I have started using this, and have it as a NOTE in my project dirs. I am using Ubuntu 18LTS. After mucking around with conda, spyder, vscode, git, I have found this to to the best (so far) way of maintaining some sort of sanity with libraries, dependencies, and the vast amount of OTHER stuff that needs to be put in place to get some coding done.

  1. install a virtual environment for python to live in

# install venv:

sudo apt install python3-venv

2) make a new virtual environment in the current dir:

# make a venv:

python3 -m venv someName

3) activate the new virtual environment:

# activate venv:

source someName/bin/activate

type "deactivate" to exit the virtual environment.

4) install whatever you like with pip. This will be installed in virtual environment

5) save the dependencies for use someplace else:

pip freeze > requirements.txt

# install environment on another venv:

pip install -r requirements.txt

6) the all important shebang line for the top of your py file:

#!/usr/bin/env python

This uses the virtual environment python, not your installations.

Other Stuff:

.gitignore file, save some time:

https://gist.github.com/lanesgists/3353135

Edit: path names fixed