Skip to content

Instantly share code, notes, and snippets.

@thecraftman
Created July 28, 2020 03:37
Show Gist options
  • Save thecraftman/fc93c38b31065a3d703a2ef23f3e57dd to your computer and use it in GitHub Desktop.
Save thecraftman/fc93c38b31065a3d703a2ef23f3e57dd to your computer and use it in GitHub Desktop.
Configuring the Python environment on WSL & Windows machine

Virtual Environment

  1. Create the venv and fix permissions:

    sudo virtualenv --python=python3 ~/weblate-env
    sudo chown -R {YOUR USERNAME}:{YOUR USERNAME} /home/{YOUR USERNAME}/weblate-env-2
    
  2. Activate, or step into, the virtual environment:

    Source ~/weblate-env/bin/activate
    
  3. Deactivate, or step out of, the virtual environment:

    deactivate 
    

pip installer

Used for python packages, similar to apt-get

  1. Install a package:

    pip install {NAME}
    

    Note: Don't use sudo in pip when in a virtual environment!

  2. If you get permission denied as an error, you have to perform the permission fix for your venv again:

    sudo chown -R {YOUR USERNAME}:{YOUR USERNAME} /home/{YOUR USERNAME}/weblate-env-2
    
  3. If you get errors like package not found or dependency error, there is likely something wrong with the package, but try several different install options to ensure it is not on your side.

apt-get

If you get an error that says package not found, try installing it with sudo apt-get

Sometimes it's worth googling the error; sometimes the package name is different

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment