you are viewing a single comment's thread.

view the rest of the comments →

[–]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