• Register
0 votes
682 views

I have python 3 and python 2.7 installed in my system.

I am a newbee and I tried to run file :

~/usr/bin/env python 2.7 

But when I try to run the file it give me an error :

~/usr/bin/env python 2.7 No such file or directory

How can I check my default python version?

How can I run the file?

How to run the file without changing my default python version?

10 7 2
6,060 points

Please log in or register to answer this question.

1 Answer

0 votes

You can create an alias to 2.7 as 3  :

sudo ln -s /usr/bin/python2.7 /usr/bin/python3

To check your default python version use the command:

python --version

You may check your python executable, versus the location of lib site-packages.

Your site-packages should be in the directory:

~/usr/lib/python2.7/site-packages

And your executable could be in the directory:

~/usr/bin

To check where it is finding the executables run the command:

which python
which python2.7
which pythohn3

 

11 6 4
34,950 points

Related questions

0 votes
1 answer 43 views
43 views
I'm trying to install spaCy using pip install spacy but I'm getting the following error .. I have VS 2015 installed, and I have the following Python install .. 3.5.2 |Anaconda 2.5.0 (64-bit)| (default, Jul 5 2016, 11:41:13) [MSC v.1900 64 ... others. This is not a unique problem to this specific library but more generally anytime I try to install Python libraries that need C to build on Windows.
asked Oct 24, 2020 psandprop 2.4k points
0 votes
1 answer 40 views
40 views
I am setting up a django project and i am using python for this. I heard that the best way to this is by setting up a virtual environment. I installed my virtual environment by typing the command in my command promp by using: pip install virtualenvwrappwer-win But when I ... environment I can not start my project. I am new In django if anyone know the solution please help me to set up my project.
asked Mar 9, 2020 LizzyM 6.1k points
0 votes
1 answer 40 views
40 views
In my system i have installed OPENCV but every time I run my code there is a error. My code is : import cv2 For this I am using 64 bit python on my system. But everytime I run this it shows me “ImportError : DLL load failed %1 is not valid win32 ... cv2.pyd and my OPENCV installaition does not have any release folders. Can anyone tell me what the error is and DLL’s is it looking for.
asked Mar 9, 2020 LizzyM 6.1k points
0 votes
1 answer 4 views
4 views
Problem: It seems to me like the files run the same without that line.this applies when you run it in Unix by making it executable (chmod +x myscript.py) and then running it directly: ./myscript.py, rather than just python myscript.py
asked Feb 19 Mashhoodch 9.3k points
0 votes
1 answer 14 views
14 views
It seems to me like the files run the same without that line.
asked Oct 25, 2020 psandprop 2.4k points
0 votes
1 answer 5 views
5 views
Problem: No such file or directory error? Are you staring at an error that says: python: can't open file 'myfile.txt': [Errno 2] No such file or directory Or maybe: IOError : No such file or directory Are you saying something like: "Curses! It works on my machine?"?
asked 5 days ago Mashhoodch 9.3k points