I am working on a virtual environment: sk, which I made this way:

$ mkvirtualenv sk -p python3

I use workon sk to activate this environment and work in it. When I try to run some functionality of the perf utility in it, it asks for permission; it advises me to use sudo. On doing so, the essence of the environment gets lost as it doesn't detect any packages that I installed in it (e.g. pandas).

I have already gone through the similar article on this site as here, which suggests using the command

sudo ./AwesomeProject/bin/python <script>

where virtualenv is ./AwesomeProject. I tried it and found the Python instance within my virtual environments to be as ./.virtualenvs/sk/bin/python3. I run the instance as:

$./.virtualenvs/sk/bin/python3 main.py

I get bash: .virtualenvs/sk/bin/python3: No such file or directory

(main.py is the python script I intend to run)

Why do I face this error with sudo and how should I overcome this ?

  • ./virtualenvs/sk/bin/python3 main.py ? May 23, 2020 at 17:33
  • @B.duGaray I have made the required edits. For context, Its actually the solution suggested by the linked answer.
    – Pe Dro
    May 23, 2020 at 17:38

1 Answer 1


The .virtualenvs directory is usually in your home directory. The output suggests that the python executable cannot be found.

Try running ~/.virtualenvs/sk/bin/python3 main.py

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.