Menu
e-lo
  • Home
    • Tech
    • Inspiration and about
  • Database
    • T-SQL
    • SQL Server quick
    • SQL server docs
    • MySql quick sheet
    • Postgre
    • InfluxDB
  • Programming
    • Automating the boring stuff
    • Python 101
    • Python Docs
    • Python Logging
    • cSharp Overview
    • Powershell Latest
    • Powershell 4 lang ref
  • Linux
    • Top CMD’s
    • Useful CMD Linux
    • ss64 Linux
    • Ubuntu
    • 30 things Ubuntu 18.04
  • Azure
    • AZ-104-MS Azure Administrator 101 quick ref
    • ARM Docs
    • ARM Tutorial
    • Azure PS ref
    • Azure CLI ref
    • Deployment scripts (intern/extern)
    • ARM Quickstart
    • ARM templates 4h
  • AzAdm
    • AD 101
    • Governance and Compliance 102
    • Administration 103
    • Virtual Networking 104
    • Storage 107 (With table (NoSQL and more))
    • Virtual Machines 108
    • Azure Virtual Machines 101
    • Monitor VM (and market)
  • Zen
    • Not thinking about anything is Zen
e-lo

Ubuntu 18.04 set up Python3 virtualenv for user (no sudo*)

Posted on July 1, 2019July 16, 2019 by espenk

Python 3 is default, type python3 or python (for v 2)

https://docs.python-guide.org/dev/virtualenvs/

virtualenv is a tool to create isolated Python environments. virtualenv creates a folder which contains all the necessary executables to use the packages that a Python project would need.

It can be used standalone, in place of Pipenv.

  • sudo apt update
  • sudo apt install python3-pip
  • sudo pip3 install virtualenv
  • pip3 -V (for version and folder)
  • Make a folder in your home dir (where you have R/W access, type ls)
  • cd to that folder
  • virtualenv -p python3 venv (no good pratice to use sudo here)
  • source venv/bin/activate
  • code
  • pip3 install requests (for example)
  • pip3 freeze for installed files, now none is installed
  • deactivate (when done)

CMD’s for pip3:

CMD’s for virtualenv:

Here we create the folder for storing all projects, view it, check pip3, cd to folder and create a new folder for that specific project (httpagent in this case). After that we execute the virtualenv cmd, view the folder and activate it. Then we install requests inside that env.

And we run pip3 freeze for checking the packets (this will differ if we type pip3 when the env is not active, then we invoke the pip3 for sudo user.

Then we execute pip3 freeze to a txt file (good practice), now we can test some code, and then we can deactivate

Install Visual Studio Code, well download the file code_1.35.1-1560350270_amd64 from distro and install it.

Then open your home folder (where you have access to R/W), then you are all set up!

RSS Azure

  • Azure and HITRUST publish shared responsibility matrix January 14, 2021

RSS Python

  • PEP 649: Deferred Evaluation Of Annotations Using Descriptors January 11, 2021

Cloud

ARM (7) azure (22) cmd (1) Django (4) Docker (1) e-lo (2) Flask (2) Github (9) Grafana (2) Information (1) Information Retrieval (11) JAVA (1) kivy (2) Kotlin (4) linux (11) mobile (2) Natural Language Prossesing (NLP) (2) Net.Core (1) Networking and Security (2) OPC (2) PEP8 (1) Philosophy (3) Python (41) Python Networking and Security (2) Reason (2) RMQ (2) Solr (11) Sql (10) VSC (1) Warframe (2) WMVARE (4) Zabbix (7)

Recent Posts

  • 2 TODO MS ARM Template 4h
  • TODO Cryptography with Python – Caesar Cipher
  • 3 TODO Udemy AZ-104 Microsoft Azure Administrator Exam Certification (Scott Duffy)
  • 1 TODO ARM Lab 104 MS (Deployment and more)
  • TODO Prerequisites for Azure administrators 101

Archives

Meta

  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
©2021 e-lo | Powered by WordPress & Superb Themes