简体   繁体   English

如何在没有 pip 的情况下安装 virtualenv?

[英]How to Install virtualenv without pip?

I have a problem on pip.我在 pip 上有问题。

As I use pyenv, using python version 3.7.x, there is no problem around pip.由于我使用pyenv,使用python 3.7.x版本,pip周围没有问题。

$ /home/yuis/.pyenv/shims/pip --version
pip 19.2.3 from /home/yuis/.pyenv/versions/3.7.6/lib/python3.7/site-packages/pip (python 3.7)

But using python version 3.6.x, I get a result that saying the pip is located on "~/.local", but not on "~/.pyenv".但是使用 python 版本 3.6.x,我得到的结果是 pip 位于“~/.local”上,但不在“~/.pyenv”上。

This is very bad for me.这对我来说非常糟糕。 Because the version what I need now is 3.6.x.因为我现在需要的版本是3.6.x。

This incomprehensive pip behavior continues if I install other python 3.6 version, so python 3.6.12 and 3.6.11 will show this same path.如果我安装其他 python 3.6 版本,这种不全面的 pip 行为会继续存在,因此 python 3.6.12 和 3.6.11 将显示相同的路径。

I guess this bug is most probably because some kind of conflict from the locally installed python and pyenv installed one.我想这个错误很可能是因为本地安装的 python 和 pyenv 安装了某种冲突。

$ /home/yuis/.pyenv/shims/pip --version
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
pip 20.3.3 from /home/yuis/.local/lib/python3.6/site-packages/pip (python 3.6)

Now, I don't care much about pip anymore, because it seems an unsolvable issue.现在,我不再关心 pip 了,因为这似乎是一个无法解决的问题。 No time to waste.没有时间浪费。 So now I want to try with virtualenv.所以现在我想尝试使用 virtualenv。

I need to install virtualenv first, because I can see this error.我需要先安装 virtualenv,因为我可以看到这个错误。

$ virtualenv venv
pyenv: virtualenv: command not found

The `virtualenv' command exists in these Python versions:
  3.5.10
  3.7.6

Note: See 'pyenv help global' for tips on allowing both
      python2 and python3 to be found.

But both of the followings didn't work.但是以下两个都不起作用。

pip install virtualenv
/home/yuis/.pyenv/shims/pip install virtualenv
python -m pip install virtualenv

Now I have no idea what is going on on my machine and how to solve this problem.现在我不知道我的机器上发生了什么以及如何解决这个问题。

Have you tried python -m virtualenv.venv ?您是否尝试过python -m virtualenv.venv

Try this maybe,试试这个,也许

pip install git+https://github.com/pypa/virtualenv.git@main

You can visit this link for further details,您可以访问此链接以获取更多详细信息,

Also make sure your python & conda env are properly configured and added to PATH还要确保您的 python 和 conda env 已正确配置并添加到 PATH

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM