创建 virtualenv 错误消息
金字塔文档说:
- “最佳实践是将 Pyramid 安装到‘虚拟’Python 环境中,以便与您在 Python 版本中安装的任何‘系统’软件包隔离”
- 来安装虚拟 Python 环境,我有要安装 setuptools,它可以
- 创建一个虚拟 Python 环境,我必须
- 在说出命令后运行“virtualenv --no-site-packages env”,它说“如果您在 UNIX 上,请勿使用 sudo 运行virtualenv script”
3 日,我运行了该命令,但权限被拒绝并使用了 sudo。我不知道使用 sudo 部分是否会出现问题,因为我不确定 Linux 是否是一种 Unix。
现在,看到这条消息后如何创建虚拟Python环境?
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 9, in <module>
load_entry_point('virtualenv==1.5.1', 'console_scripts', 'virtualenv')()
File "/usr/local/lib/python2.6/dist-packages/virtualenv-1.5.1-py2.6.egg/virtualenv.py", line 558, in main
prompt=options.prompt)
File "/usr/local/lib/python2.6/dist-packages/virtualenv-1.5.1-py2.6.egg/virtualenv.py", line 647, in create_environment
site_packages=site_packages, clear=clear))
File "/usr/local/lib/python2.6/dist-packages/virtualenv-1.5.1-py2.6.egg/virtualenv.py", line 931, in install_python
stdout=subprocess.PIPE)
File "/usr/lib/python2.6/subprocess.py", line 623, in __init__
errread, errwrite)
File "/usr/lib/python2.6/subprocess.py", line 1141, in _execute_child
raise child_exception
OSError: [Errno 13] Permission denied
The pyramid documentation says:
- "It is best practice to install Pyramid into a 'virtual' Python environment in order to obtain isolation from any 'system' packages you’ve got installed in your Python version"
- to install a Virtual Python Enviroment, I have to install setuptools, it worked
- to create a Virtual Python Enviroment, I have to run "virtualenv --no-site-packages env"
- after saying the command, it says "If you’re on UNIX, do not use sudo to run the virtualenv script"
On 3, I ran the command, got permission denied and used sudo. I don't know if the using sudo part is going to be a problem, because I'm not sure if Linux is a kind of Unix.
Now, how to create a virtual python enviroment after seeing this message?
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 9, in <module>
load_entry_point('virtualenv==1.5.1', 'console_scripts', 'virtualenv')()
File "/usr/local/lib/python2.6/dist-packages/virtualenv-1.5.1-py2.6.egg/virtualenv.py", line 558, in main
prompt=options.prompt)
File "/usr/local/lib/python2.6/dist-packages/virtualenv-1.5.1-py2.6.egg/virtualenv.py", line 647, in create_environment
site_packages=site_packages, clear=clear))
File "/usr/local/lib/python2.6/dist-packages/virtualenv-1.5.1-py2.6.egg/virtualenv.py", line 931, in install_python
stdout=subprocess.PIPE)
File "/usr/lib/python2.6/subprocess.py", line 623, in __init__
errread, errwrite)
File "/usr/lib/python2.6/subprocess.py", line 1141, in _execute_child
raise child_exception
OSError: [Errno 13] Permission denied
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
确保您位于可以在其中创建文件和文件夹的目录,例如:
Make sure you are in a directory that you can create files and folders in, e.g.:
正如有人已经说过的,您需要在不使用 sudo 的情况下启动 virtualenv。
这对我有用。
As somebody already said, you need to start the
virtualenv
withoutsudo
.This is what worked for me.
安装setuptools并运行“virtualenv --no-site-package”后,您实际上并没有安装virtualenv,
因此首先您必须安装virtualenv(您必须是root用户):
然后只需执行以下操作:
linux也是一个类似unix的系统(以回答您的问题)问题“Linux 是否是一种 Unix”)。
在这里您可以找到有关类 Unix 系统的更多信息 - wikipedia-Unix-like
after installing setuptools and running "virtualenv --no-site-package" you didnt actually install virtualenv
so first you must install virtualenv (you must be root for this):
then just do:
also linux is a unix like system (to answer your question if "Linux is a kind of Unix").
here you will find out more about unix-like systems - wikipedia-Unix-like