我正在使用 virtualenv 为每个版本的 python 创建不同的虚拟环境。执行以下命令会引发 Permission denied 错误。
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
我已经正确安装了 python3 和 virtualenv。virtualenv 的版本是:
yolk -l virtualenv
virtualenv - 1.8.4 - active development (/usr/local/lib/python2.7/dist-packages)
我在这里错过了什么吗?请帮帮我。
顺便说一句,没有选项“-p /usr/bin/python3”可以正常工作,如下所示。
sudo virtualenv --no-site-packages pytest
New python executable in pytest/bin/python
Installing setuptools............done.
Installing pip...............done.