How to run and manage different versions of Python with virtual environment support by using pyenv

In this post,I am sharing how we can run different versions of python easily with virtual environment support  by usng pyenv .I am using pyenv these days.I find it better than using virtualenv .My currently activated environment remains activated even after restarting Terminal shell which I prefer.Another feature of pyenv  is that you can set environment local to any folder.

Thanks : Yamashita  (Author of pyenv )

Steps :

1.Use pyenv-installer   to install pyenv.You can install pyenv by using this command on Terminal :

$ curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash

 

2.To update  pyenv ,use this command :

$ pyenv update

Screenshot from 2017-07-29 11-25-48.png

 

3.Open your .bashrc  file and make sure that these lines are added to it .Otherwise,you need to add these lines  to your .bashrc  file  by editing the file wih sudo command:

# Load pyenv automatically by adding
# the following to ~/.bash_profile:

export PATH=”/home/gaurav/.pyenv/bin:$PATH”
eval “$(pyenv init -)”
eval “$(pyenv virtualenv-init -)”

 

4. To install specific version of Python ,say Python 3.6.1 ,use this command :

$ pyenv install 3.6.1

 

5.To create a virtual environment system ,say  test which uses Python  3.6.1 which we installed in previous step,you can use this command :

$ pyenv virtualenv 3.6.1 test

 

6.To activate this new virtual environment test ,you need to use this command :

$ pyenv virtualenv 3.6.1 test

 

7.To list all virtual environments of pyenv ,use this command :

$ pyenv versions

 

7.To switch back to system Python ,use this command :

$ pyenv global system

 

Screenshot from 2017-07-29 11-29-28.png

 

8.To uninstall any virtual environment ,say test ,use this command and Entere when it asks for confirmation :

$ pyenv uninstall test

 

Now,you can easily run different versions of Python along with virtual environment support.

Thanks  for reading my post.I hope this post will be useful for them who  want to manage different versions of python with virtual environment support .If you have any query/question,please post in comments section.

 

 

 

Advertisements

How to decompile compiled .pyc python files to find/see original source code

Hello,everyone.In this post,i am sharing how to decompile compiled python files which are in .pyc formats usually.It may be useful for reverse enginering and if you want to know the original source code of any compiled python files.It may be also useful whenever  your original .py  python file is deleted unknowingly and there is only compiled .pyc file left  on disk and you want your original .py file back.In all those cases, this method can be used.

I have used Ubuntu OS here and it can be used on Windows OS also.

Tools Required :

uncompyle6  : https://github.com/rocky/python-uncompyle6/

Thanks :R. Bernstein (Author of uncompyle6)

Steps :

1.Install uncompyle6 by using pip on Terminal or you can download from above link and install it by running its setup.py file.To install uncompyle6 by using pip,use this command on Terminal :

pip install uncompyle6

 

2.After installation of  uncompyle6 ,you can check its successfull installation and its usage by running uncompyle6 command on Terminal (see screenshot).

 

3.To decompile any file in current diectory ,use command (see screenshot for example): uncompyle6 -o . <file-name.pc> 

Example : uncompyl6 -o . txfile.pyc rxfile.pyc

Screenshot from 2017-07-01 13-38-05

 

4.You will see your decompiled files created with same name in the current working directory(or desired directory) .Now,you can open this decompiled file with any Text Editor and see original source code.

Screenshot from 2017-07-01 13-38-46.png

 

5.if you want to see decompiled code on terminal(standard output),use command(see screenshot for example ): uncompyle6 <filename.pyc>

Screenshot from 2017-07-01 13-39-59.png

 

Thanks for reading my post.I hope this will be useful for python users who want to decompile compiled python files.

 

 

 

 

How to fix Realtek RTL8723BE Wireless Network Adapter Low Wi-Fi Signal Issue on Ubuntu/Linux OS

Hello,everyone.Today , I  want to share how to fix Realtek RTL8723BE Wireless Network Adapter Low Wi-Fi Signal Issue on Ubuntu/Linux OS.This tutorial can be also used for other Realtek Wireless Network Adapters supported by rtlwifi_new .

I have a great interest in using Using Ubuntu OS , so I installed latest version of Ubuntu OS alongside Windows OS.But, I faced low Wi-Fi signal issue on Ubuntu OS .Ubuntu OS failed to find many Wi-Fi networks which I could easily find & use on Windows OS.  Then,I started finding solutions to my problem and I found  a working solution.

Tools Required :

rtlwifi_new : https://github.com/lwfinger/rtlwifi_new

Steps :

1.Download rtlwifi_new from above link and extract it to Desktop (or to your desitrd folder).

2.Open Terminal and change your directory to the folder where you extracted rtlwifi_new zip file (here , Desktop/rtlwifi_new-master )  by using cd  command .See Screenshot given below :

cd   Desktop/rtlwifi_new-master 

3.Now,run this command in Terminal as shown in Screenshot given below:

make clean  (optional for first time installation,you can use it for further installation)

make 

Screenshot from 2017-06-18 12-17-22.png

 

4.After that ,run this command in terminal  as shown in screenshot given below:

sudo make install  

Screenshot from 2017-06-18 12-19-13.png

 

5.If everything is allright,you will see the message  ” Install rtlwifi SUCCESS  “  . It means that rtlwifi has beeen installed successfully.

6.Now,run this command as shown in screenshot given below :

sudo modprobe rtl8723be 

7.After that , run this command as shown in screenshot given below :

echo “options rtl8723be ant_sel=2” | sudo tee /etc/modprobe.d/rtl8723be.conf

8.This step is optional.If you want to see that  text contents are written successfully to /etc/modprobe.d/rtl8723be.conf .you can use this command  as shown in screenshot given below :

cat /etc/modprobe.d/rtl8723be.conf

Screenshot from 2017-06-18 12-27-53.png

 

9.If all the above commands ae executed successfully,then everything has been done. Now,you need to restart your computer and you will see Wi-Fi working properly and your computer will find available Wi-Fi   networks in your area.

10.After restarting  your computer, select Wi-Fi network which you want to connect .

Screenshot from 2017-06-18 12-35-14.png

 

I hope this post will be useful for many users who use Realtek Wireless Network Adapter  and face low Wi-Fi signal issues on Ubuntu OS.

If you have any query or you face any problem ,please comment.Thank you for reading my post.

Thankslwfinger ( Author of rtlwifi_new)

Sources:

1.  https://askubuntu.com/questions/645220/unable-to-connect-wifi-ubuntu-14-04-lts-hp-pavilion-network-driver-rtl8723be/729660#729660  

2. https://askubuntu.com/questions/635625/how-do-i-get-a-realtek-rtl8723be-wireless-card-to-work/635629#635629

3. https://connectwww.com/how-to-solve-realtek-rtl8723be-weak-wifi-signal-problem-in-ubuntu/4625/

 

 

 

Using Python3 and Python2 on Windows OS with pip support

Hello everyone.Today,I am going to share how to use Python3 and Python2 with pip support  on Windows OS.If you try to install latest Python version 3.6 ,it provides you the option of adding Python 3.6 to PATH ,but this is not provided by Python2 installer still.Many users may find it difficult to use both version with corresponding pip on Windows OS.

So,I am sharing this method which helped me to use Python2 and Python3 simultaneously.

STEPS :

1.Download Python3 and Python2 installer from python.org .

2.Run Python3 installer and tick(enable) “Add Python 3.6 to Path” as shown in screenshot so that you can run Python3 by python command on Terminal/Shell.

p3s

 

3.You can run Python3 by using python command and its pip by using pip command.

4.Run Python2 installer and install Python2 .

5.Now ,you need to edit system environment  variable PATH as shown in screenshot below  for using Python2  and its pip2 in Terminal/shell :

path_setup

 

6.Click on Edit Button .After that all the enteries of  PATH  variable will be displayed.Now,click on New Button and add this entry as shown in screenshot:

C:\Python27\Scripts

path_edit.JPG

 

7.Click on OK button to save and make it sure that the entry added to PATH varaiable is not C:\Python27  . Otherwise , python command will run Python2 instead of Python3 .

8. Again add a new entery PY_PATH to system variables and set its value to 2 if you want to run python2 by using py command.

9.Now, you can use Python 3 by using python or py -3 . You can use pip for python 3 by pip or pip3 command .You can use Python2 by using py command or py-2 command .You can use pip for Python2 by using pip2 command.(See Screenshot)

pipnnn.JPG

 

If every step is followed correctly,you will see Python3 and Python2 running successfully with pip support in Terminal.

If you have any query or you need help,post in comments.I will be glad to help you.

Thanks for reading my post.I hope my post will be useful to Python users who are using Windows OS.

 

 

 

Bitly v1.00.0 pys60 app for Symbian S60 by gauravssnl based on bitly_python API

Bitly v1.00.0 pys60 app by gauravssnl based on bitly python API

Geneate bit.ly short URL of any long URL easily and exapand bit.ly URL to get original link.

Bit.ly URLs are used for sharing links on social networking sites and on blogs to make long URLs shorter.

Download link : Bitly app v1.00.0 by gauravssnl.zip

Screenshot :

ss

 

Features :

-Generate bit.ly link

-Expand bit.ly link

Steps :

1. Register an account on bitly.com by visiting this link : https://bitly.com/a/sign_up

2.After that ,you need to get your bitly Access Token of your account

3.Now open Bitly app , and enter your Access Token in Settings from menu.

4.Now,click on Connect .If your Access Token is correct, you will be successfully logged in and your users details will be displayed. If this does not occur, check your Access Token and try again.

5.Now,you can generate bit.ly short URLs and expand bit.ly URLS to get original links

Thanks : Jehiah Czebotar (bitly_ api author)

Thanks everyone.

Py Pastebin v1.00.2 PyS60 App for Symbian S60 by gauravssnl

Py Pastebin v1.00.02 pys60 2.0 app by gauravssnl for Symbian S60 OS

DownloadPy Pastebin v1.00.2 by gauravssnl.zip

This app is for creating new pastes directly from files on pastebin.com

There is no need to open pastebin website and copy & paste your codes.
Pastebin is very famous code sharing website.
I hope this app will be useful for symbian s60 users.

Screenshots :


How to use :
1.You must have an account on pastebin.com
If you do not have an account,you can create a new account .
2.Log /Sign into your account
3.Get your own unique API key by visiting this URL :
pastebin.com/api

4.Now open app Py Pastebin and click on Login Settings.Fill your API Key,username ,passwords.

15241737_1308228179233198_3312973459983355607_n

5.Click on ‘Login’ and wait for successful login.If you are not able to login after several tries ,that means your API key is invalid.Verify your API key.
6.After successful login,you can select a file for creating paste.If paste is succesffully created,that paste URL will be shown.

Thanks everyone.

How to use Python v2 and v3 in Termux app on Android : Simple way to use Python without need of rooting

Today,I am gonna share how to use Python in Termux app on Android phone without need of rooting . It’s very simple and easy way to use Python. Thanks to the developer of Termux , Fredrik Fornwall.

Python v3 installation : 

1.Open Termux app and type this command:

apt install python 

screenshot_20161231-081311

 

2.Now type y if you want to proceed.Otherwise n .

 

3.After successful installation, you can use Python by using this command:

python 

screenshot_20161231-082914

 

 

 

Python v2 installation :

1.Use this command to install python2 :

apt install python2

screenshot_20161231-082740

2.To run python2, use this command: python2

I hope this post will be useful to them who want to use Python v3 and v2 without need of rooting Android phone.

Thanks : Minakshi

Thanks to my family.

How to use Termux App for Android : Terminal Emulator and Linux environment

Termux is an Android terminal emulator and Linux environment app that works directly with no rooting or setup required. A minimal base system is installed automatically.Additionall packages are available using the APT package manager.

Developer: Fredrik Fornwall 

Download link: https://termux.com screenshot_20161231-080757

 

 

Steps and Instructions :

1.Download Termux app and install it.Open Termux and wait for its complete installation.screenshot_20161231-080835

2.Now, for first time you need to use this command (as shown in screenshot):

 apt update screenshot_20161231-081205

3.Now,we can use  apt command.To know how to use apt , click on Help in Termux app  (Long press in Termux Terminal window will bring menu )

 

4.To get list of available packages,use this command:

apt list screenshot_20161231-083450

5.To install any package,say python ,use this command:

apt install python screenshot_20161231-081311

 

5.To search any package,say python. Use this command:

apt search python screenshot_20161231-081311

6.To remove/uninstall a package,say python , use this command:

apt remove python

7.To see installed packages, use this command:

apt list –installed Screenshot_20161231-090507.png

I hope this post will be useful to Android users who want to use Terminal with Linux environment on Android  without need of rooting their phone.

Thanks to my family and friends.

 

 

How to use Python For Android in Terminal on all Android OS easily by using updated python.sh script

Hello,everyone.In this post,I am going to share how to use Python For Android in Terminal in the easiest way .This method will work on all Android OS versions .This method has been tested on all OS by me and works successfully.By using this method,you can also run  Python with your desired command name  .Let us proceed to the tutorial.

Tools Required: 

1. Python For Android.apk :  Download Here

2. python.sh file (fixed and updated) :  Download Here

3.Terminal.apk : Download Here

Working Screenshot:screenshot_2016-09-05-11-15-01.png

 

Steps:

1.Download & Install Python For Android app.Open it and install it’s Python library by clicking on “Install ” Button.Internet is required for first time installation.After successful installation of Python library,your screen will be as shown in screenshot below:screenshot_2016-09-03-19-28-48.png

2.Now,copy downloaded python.sh script file to /system/bin folder.Now,change the permission of Python.sh file to 777 in /system/bin folder.

3.Now ,open Terminal and you can easily run Python with the command as shown in Screenshot:

python.sh

screenshot_2016-09-05-11-15-01.png

4.If everything is correct,you will see Python running successfully in Terminal.

5.You can also rename the python.sh file in /system/bin to any name you like & then you can use that name as command for running Python.I have renamed python.sh file to gaurav

screenshot_2016-09-05-11-16-58.png

6.Now,i can run Python in Terminal by using command:

gaurav

screenshot_2016-09-05-11-18-00.png

 

7.In that way,you can run Python with your desired command name.

Thanks: Luiz

Happy Phreaking brothers.

Thanks everyone for reading my post.Thanks to my  friends and family.

Post your questions in Comments.