创建 virtualenv 错误消息

发布于 2024-10-19 13:32:43 字数 1269 浏览 3 评论 0原文

金字塔文档说:

  1. “最佳实践是将 Pyramid 安装到‘虚拟’Python 环境中,以便与您在 Python 版本中安装的任何‘系统’软件包隔离”
  2. 来安装虚拟 Python 环境,我有要安装 setuptools,它可以
  3. 创建一个虚拟 Python 环境,我必须
  4. 在说出命令后运行“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:

  1. "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"
  2. to install a Virtual Python Enviroment, I have to install setuptools, it worked
  3. to create a Virtual Python Enviroment, I have to run "virtualenv --no-site-packages env"
  4. 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

能否归途做我良人 2024-10-26 13:32:43

确保您位于可以在其中创建文件和文件夹的目录,例如:

cd # Go to your home directory
virtualenv --no-site-packages env # Create virtualenv

Make sure you are in a directory that you can create files and folders in, e.g.:

cd # Go to your home directory
virtualenv --no-site-packages env # Create virtualenv
白色秋天 2024-10-26 13:32:43

正如有人已经说过的,您需要在不使用 sudo 的情况下启动 virtualenv。

这对我有用。

As somebody already said, you need to start the virtualenv without sudo.

This is what worked for me.

甜柠檬 2024-10-26 13:32:43

安装setuptools并运行“virtualenv --no-site-package”后,您实际上并没有安装virtualenv,

因此首先您必须安装virtualenv(您必须是root用户):

$ easy_install virtualenv

然后只需执行以下操作:

$ virtualenv --no-site-package myVirtualEnv
    New python executable in myVirtualEnv/bin/python
    Installing setuptools............done.

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):

$ easy_install virtualenv

then just do:

$ virtualenv --no-site-package myVirtualEnv
    New python executable in myVirtualEnv/bin/python
    Installing setuptools............done.

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文