virtalalenv与--always-copy抛出错误“操作不允许”

时间:2016-07-20 22:35:49

标签: python python-2.7 virtualenv

我正在尝试运行virtualenv而没有符号链接python2.7但是当我使用标志--always-copy时我得到权限错误。

virtualenv --always-copy myenv

Traceback (most recent call last):  

  File "/usr/local/bin/virtualenv", line 11, in <module>  
    sys.exit(main())  
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 711, in main  
    symlink=options.symlink)  
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 924, in create_environment  
    site_packages=site_packages, clear=clear, symlink=symlink))  
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 1129, in install_python  
    copyfile(join(stdlib_dir, fn), join(lib_dir, fn), symlink)  
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 355, in copy file  
    copyfileordir(src, dest, symlink)  
  File "/Library/Python/2.7/site-packages/virtualenv.py", line 327, in copyfileordir  
    shutil.copytree(src, dest, symlink)  
  File   "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 208, in copytree  
    raise Error, errors  
shutil.Error:  
[('/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config/config.c', '/Users/user1/myenv/lib/python2.7/config/config.c', "[Errno 1] Operation not permitted: '/Users/user1/myenv/lib/python2.7/config/config.c'"), ...

1 个答案:

答案 0 :(得分:-1)

如果没有其他详细信息,很难回答,但我的猜测是你需要首先进行sudo。

所以sudo virtualenv --always-copy myenv