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/