rajpy
rajpy

Reputation: 2476

Not able use python3 in virtualenv

I was creating different virtual environment for each version of python using virtualenv. Executing below command throws Permission denied error.

sudo virtualenv --no-site-packages -p /usr/lib/python3 py3

Traceback (most recent call last):
  File "/usr/local/bin/virtualenv", line 9, in <module>
    load_entry_point('virtualenv==1.8.4', 'console_scripts', 'virtualenv')()
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py", line 919, in main
    popen = subprocess.Popen([interpreter, file] + sys.argv[1:], env=env)
  File "/usr/lib/python2.7/subprocess.py", line 672, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1213, in _execute_child
    raise child_exception
OSError: [Errno 13] Permission denied

I have both python3 and virtualenv installed properly. Version of virtualenv is :

yolk -l virtualenv

virtualenv      - 1.8.4        - active development (/usr/local/lib/python2.7/dist-packages)

Am I missing something here? Please help me out.

BTW, without option "-p /usr/bin/python3" works fine as shown below.

sudo virtualenv --no-site-packages  pytest

New python executable in pytest/bin/python
Installing setuptools............done.
Installing pip...............done.

Upvotes: 0

Views: 2209

Answers (1)

Martin v. L&#246;wis
Martin v. L&#246;wis

Reputation: 127527

You need to specify /usr/bin/python3, instead of /usr/lib/python3, for the -p option.

Upvotes: 4

Related Questions