• Home
  • Releases
  • Press Coverage
  • About
  • PGP
  • Contact
    • Contact
    • Submit Vuln
  • HoneyPots
  • Tutorials
    • Photoshop on Linux
    • macOS on Linux
Saturday, March 6, 2021
  • Login
Sick Codes - Security Research, Hardware & Software Hacking, Consulting, Linux, IoT, Cloud, Embedded, Arch, Tweaks & Tips!
  • Home
  • Releases
  • Press Coverage
  • About
  • PGP
  • Contact
    • Contact
    • Submit Vuln
  • HoneyPots
  • Tutorials
    • Photoshop on Linux
    • macOS on Linux
No Result
View All Result
Sick Codes - Security Research, Hardware & Software Hacking, Consulting, Linux, IoT, Cloud, Embedded, Arch, Tweaks & Tips!
  • Home
  • Releases
  • Press Coverage
  • About
  • PGP
  • Contact
    • Contact
    • Submit Vuln
  • HoneyPots
  • Tutorials
    • Photoshop on Linux
    • macOS on Linux
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 admin
January 22, 2021
in Tutorials
0 0
0
Share on FacebookShare on TwitterTelegram

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

Leave a Reply Cancel reply

Your email address will not be published.

No Result
View All Result
  • Home
  • Releases
  • Press Coverage
  • About
  • PGP
  • Contact
    • Contact
    • Submit Vuln
  • HoneyPots
  • Tutorials
    • Photoshop on Linux
    • macOS on Linux

© 2017-2020 Sick.Codes

Welcome Back!

Login to your account below

Forgotten Password?

Create New Account!

Fill the forms bellow to register

All fields are required. Log In

Retrieve your password

Please enter your username or email address to reset your password.

Log In