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)
为什么用sudo会遇到此错误,我该如何克服呢?