简体   繁体   English

如何将virtualenv脚本安装到/ usr / bin

[英]How to install virtualenv scripts to /usr/bin

I install virtualenv with command sudo /usr/bin/pip-2.6 install virtualenv 我使用命令sudo /usr/bin/pip-2.6 install virtualenv

And it says 它说

Requirement already satisfied (use --upgrade to upgrade): 
virtualenv in /usr/local/lib/python2.6/dist-packages
Cleaning up...

Why pip from /usr/bin looks to /usr/local/lib? 为什么/ usr / bin中的pip看起来是/ usr / local / lib?

I need to install virtualenv scripts directly to /usr/bin, so I write 我需要将virtualenv脚本直接安装到/ usr / bin,所以我写

sudo /usr/bin/pip-2.6 install --install-option="--install-scripts=/usr/bin" virtualenv

But again it responds with 但它再次回应

Requirement already satisfied (use --upgrade to upgrade): 
virtualenv in /usr/local/lib/python2.6/dist-packages
Cleaning up...

Adding --upgrade doesn't help. 添加--upgrade没有帮助。

How can I install virtualenv scripts to /usr/bin ? 如何将virtualenv脚本安装到/ usr / bin?

Try: 尝试:

sudo /usr/bin/pip-2.6 install --install-option="--prefix=/usr/bin" virtualenv

( source ). 来源 )。

For your current issue can you first uninstall virtualenv using pip, and then reinstall using --script-dir=DIR, -s DIR as an --install-option . 对于当前问题,您可以先使用pip卸载virtualenv,然后使用--script-dir=DIR, -s DIR作为--install-option重新--install-option

As for your issue running pip with extra arguments and install not seeming to do anything, that may be fixed on develop branch at https://github.com/pypa/pip if not please file a bug with us on the GitHub issue tracker for pip. 至于您的问题运行带有额外参数的pip和安装似乎没有任何作用,可能会在https://github.com/pypa/pip的 develop分支上进行修复,如果没有,请在GitHub问题跟踪器上向我们提交错误点子

As to why it is behaving like this - the install is based on the python installation not on the location of pip. 至于为什么会这样-安装是基于python安装而不是pip的位置。 Pip uses setuptools/distribute under the hood and conforms to the configuration of the python it is running under. Pip在后台使用setuptools / distribute并符合其下运行的python的配置。

You can see where the version of python you are using installs to by running it - in this case probably python2.6 and querying the sys module. 您可以通过运行它来查看要使用的python版本安装到的位置-在这种情况下,可能是python2.6并查询sys模块。


>>> import sys
>>> sys.prefix
>>> sys.exec_prefix

See also distutils.sysconfig 另请参见distutils.sysconfig

For more information: 欲获得更多信息:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 / usr / bin中的Python脚本 - Python scripts in /usr/bin 创建一个debian包,将python脚本安装到Ubuntu中的/ usr / local / bin - Create a debian package to install python scripts to /usr/local/bin in Ubuntu 如何修复 /usr/local/bin/virtualenv: /usr/bin/python: 错误的解释器:没有这样的文件或目录? - How to fix /usr/local/bin/virtualenv: /usr/bin/python: bad interpreter: No such file or directory? 如何在 /usr/bin/python 上安装 python 3.8.12? - How to install python 3.8.12 on /usr/bin/python? virtualenv没有干扰#!/ usr / bin / env python - virtualenv without interfering #!/usr/bin/env python VIRTUALENV bash:/ usr / local / bin / virtualenv:/ usr / bin / python:错误的解释器:没有这样的文件或目录 - VIRTUALENV bash: /usr/local/bin/virtualenv: /usr/bin/python: bad interpreter: No such file or directory 在 macOS 上将 Python 3 安装到 /usr/bin/ - Install Python 3 to /usr/bin/ on macOS 如何将python包安装到/usr/local/bin? - How do I install a python package to /usr/local/bin? 如何在 macos 上将 python scipts 安装到 /usr/local/bin? - How to install python scipts to /usr/local/bin on macos? Python virtualenv bin 脚本总是以代码 1 退出 - Python virtualenv bin scripts always exit with code 1
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM