• Home
  • Releases
  • Submit Vuln
  • Press
  • About
  • PGP
  • Contact
    • Contact
    • Submit Vuln
    • VDP
  • Tutorials
    • All Posts
    • Photoshop on Linux
    • macOS on Linux
  • Supporters
  • Projects
  • Training
Sick Codes - Security Research, Hardware & Software Hacking, Consulting, Linux, IoT, Cloud, Embedded, Arch, Tweaks & Tips!
  • Home
  • Releases
  • Submit Vuln
  • Press
  • About
  • PGP
  • Contact
    • Contact
    • Submit Vuln
    • VDP
  • Tutorials
    • All Posts
    • Photoshop on Linux
    • macOS on Linux
  • Supporters
  • Projects
  • Training
No Result
View All Result
Sick Codes - Security Research, Hardware & Software Hacking, Consulting, Linux, IoT, Cloud, Embedded, Arch, Tweaks & Tips!
  • Home
  • Releases
  • Submit Vuln
  • Press
  • About
  • PGP
  • Contact
    • Contact
    • Submit Vuln
    • VDP
  • Tutorials
    • All Posts
    • Photoshop on Linux
    • macOS on Linux
  • Supporters
  • Projects
  • Training
No Result
View All Result
Sick Codes - Security Research, Hardware & Software Hacking, Consulting, Linux, IoT, Cloud, Embedded, Arch, Tweaks & Tips!
No Result
View All Result
Home Tutorials

Python Cygwin venv: The ONLY WAY To Install Python2 and Python3 on Cygwin and use it properly.

by Sick Codes
January 22, 2021
in Tutorials
1

Without using a virtualenv, every time you use pip, your python environment will mix and match cygwin packages with pip packages. This will cause enormous issues when you try to install more and more pips.

Install absolute bare minimum: python2 & python3, devel version for both, and virtualenv for both.

python python3 python-devel python3-devel python-virtualenv python3-virtualenv

ALL other packages will be done through the virtual environment.

Here are scripts, in Windows old school command line (cmd.exe and .bat files) and also cygwin shell (bash).

Automated Setup Option 1: Using Cygwin shell

Install wget from cygwin.

And then, in the cygwin shell:

wget https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg -O /bin/apt-cyg
chmod a+x /bin/apt-cyg
/bin/apt-cyg --version
apt-cyg update
apt-cyg install diffutils git bash bash-completion openssh sshpass zstd rsync zip
apt-cyg install cygwin64-gcc-core cygwin64-gcc-g++ gcc-fortran make automake alternatives ca-certificates zlib0
apt-cyg install python python3 python-devel python3-devel python-virtualenv python3-virtualenv
apt-cyg install make automake gcc-core gcc-g++ zlib zlib-devel libffi-devel openssl-devel
/usr/bin/python3 -m venv ~/my_virtual_env
source ~/my_virtual_env/bin/activate

Use as follows:

~/my_virtual_env/bin/python -m pip install -r requirements.txt

~/my_virtual_env/bin/python scripy.py

Option 2: Using Windows cmd.exe shell

*** Very important when using cmd.exe and .bat files. You must re-set the PATH when starting the cmd, after source command, and for future uses.

Install wget from cygwin.

In the cmd.exe Windows shell, or .bat file:

SET ROOTDIR=C:/cygwin
set PATH=%ROOTDIR%/bin;%CD%;%PATH%
%ROOTDIR%/bin/bash.exe -c 'wget https://raw.githubusercontent.com/transcode-open/apt-cyg/master/apt-cyg -O /bin/apt-cyg'
%ROOTDIR%/bin/bash.exe -c 'chmod a+x /bin/apt-cyg'
%ROOTDIR%/bin/bash.exe -c "apt-cyg install python python3 python-devel python3-devel python-virtualenv python3-virtualenv"
%ROOTDIR%/bin/bash.exe -c "apt-cyg install make automake gcc-core gcc-g++ zlib zlib-devel libffi-devel openssl-devel"
SET ROOTDIR=C:/cygwin
set PATH=%ROOTDIR%/bin;%CD%;%PATH%
%ROOTDIR%/bin/bash.exe -c "/usr/bin/python3 -m venv ~/my_virtual_env"
%ROOTDIR%/bin/bash.exe -c "source ~/my_virtual_env/bin/activate"

In subsequent .bat files, you must set the PATH first.

SET ROOTDIR=C:/cygwin
set PATH=%ROOTDIR%/bin;%CD%;%PATH%
%ROOTDIR%/bin/bash.exe -c "/home/"%USERNAME%"/my_virtual_env/bin/python -m pip install -r ~/some_project/requirements.txt"
Next Post
How to install micropython on esp32

How to Install Micropython on ESP32 (Linux)

How to install linux git on Arch Linux

How to Install linux-git on Arch Linux for Testing Upstream Kernels & Release Candidates

How to Move Docker Directory, Run Docker From Block Storage, Run Docker from External Drive!

Comments 1

  1. Anonymous says:
    2 years ago

    Looks like tutorial is outdated now 🙂

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

No Result
View All Result
  • Home
  • Releases
  • Submit Vuln
  • Press
  • About
  • PGP
  • Contact
    • Contact
    • Submit Vuln
    • VDP
  • Tutorials
    • All Posts
    • Photoshop on Linux
    • macOS on Linux
  • Supporters
  • Projects
  • Training

© 2017-2021 Sick.Codes

@sickcodes

@sickcodes

@sickcodes

Discord Server

sickcodes.slack.com

t.me/sickcodeschat

./contact_form