Python Forum

Full Version: python can't showing version
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
i have a problem here

when i want to check my python version on cmd, it wasn't showing a version and opened to gpython.exe, i dont know what is going on

it is effected to me while im installing django in my environment

and the pop up error message say that can't import runpy module
you should be able to pass -V argument to python to get your python version

metulburr@ubuntu:~$ python -V
Python 2.7.12
metulburr@ubuntu:~$ python3 -V
Python 3.7.2
metulburr@ubuntu:~$ python3.6 -V
Python 3.6.1
and you can do the same for pip
metulburr@ubuntu:~$ pip -V
pip 18.0 from /usr/local/lib/python2.7/dist-packages/pip-18.0-py2.7.egg/pip (python 2.7)
metulburr@ubuntu:~$ pip3 -V
pip 9.0.1 from /usr/local/lib/python3.6/site-packages (python 3.6)
based on researching: runpy should be installed by default with the environment, try delete and creating a new one. Not sure though as i dont use virutal environments.
Runpy is installed by default with your environment.
Something wrong by you or something else may have happen,creating another one should fix the problem.

Here is the basic and venv is now build into Python from 3.6-->
Use cmder as cmd is not good at all.
C:\code                                                                                                        
λ python -V                                                                                                    
Python 3.7.2                                                                                                   
                                                                                                               
C:\code                                                                                                        
λ pip -V                                                                                                       
pip 19.0.3 from c:\python37\lib\site-packages\pip (python 3.7)                                                 

# Make environment                                                                                                                
C:\code                                                                                                        
λ python -m venv test_env                                                                                      

# Cd in                                                                                                               
C:\code                                                                                                        
λ cd test_env                                                                                                  

# Activate                                                                                                               
C:\code\test_env                                                                                               
λ C:\code\test_env\Scripts\activate                                                                            

# Now pip should point to environment,not OS install                                                                                                               
(test_env) C:\code\test_env                                                                                    
λ pip -V                                                                                                       
pip 18.1 from c:\code\test_env\lib\site-packages\pip (python 3.7)                                              

# Test install                                                                                                               
(test_env) C:\code\test_env                                                                                    
λ pip install requests                                                                                         
Collecting requests                                                                                            
...................                                                                
Installing collected packages: certifi, idna, urllib3, chardet, requests                                       
Successfully installed certifi-2018.11.29 chardet-3.0.4 idna-2.8 requests-2.21.0 urllib3-1.24.1
Alternative is pipenv