User Tools

Site Tools


linux:set-up-python3-environment-and-pip3

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

linux:set-up-python3-environment-and-pip3 [2019/01/21 11:08] (current)
seanburns created
Line 1: Line 1:
 +<​markdown>​
 +# Set up Python3 Environment and Pip3
 +## Date: Thu Sep 13 10:07:00 EDT 2018
  
 +Brief tutorial on using Python3 and Pip3 on the server. This is based on 
 +the more extensive tutorial available on [Digital Ocean][1].
 +
 +## To install and set up
 +
 +After logging in, assuming you're in your home directory:
 +
 +Make your environment directory:
 +
 +``$ mkdir environments``
 +
 +Change to it:
 +
 +``$ cd environments/​``
 +
 +Create the environment:​
 +
 +``$ python3 -m venv my_env``
 +
 +Check it out:
 +
 +``$ ls my_env/``
 +
 +Activate it:
 +
 +``$ source my_env/​bin/​activate``
 +
 +Create a basic Python3 program:
 +
 +``$echo "​print('​Hello world'​)"​ >> hello.py``
 +
 +Run it:
 +
 +``$ python hello.py``
 +
 +Delete it, if you wish:
 +
 +``$ rm hello.py`` ​
 +
 +When you're done working in your environment,​ deactivate it:
 +
 +``$ deactivate``
 +
 +## Post Setup
 +
 +After you've set things up, you just need to activate, do some Python, and 
 +then deactivate it when you want to do some Python programming:​
 +
 +``$ source my_env/​bin/​activate``
 +
 +Do some Python programming.
 +
 +And when done:
 +
 +``$ deactivate``
 +
 +[1]:​https://​www.digitalocean.com/​community/​tutorials/​how-to-install-python-3-and-set-up-a-local-programming-environment-on-ubuntu-16-04
 +</​markdown>​
linux/set-up-python3-environment-and-pip3.txt ยท Last modified: 2019/01/21 11:08 by seanburns