简体   繁体   English

在我的虚拟环境中找不到 pip 或 conda 命令

[英]No pip or conda command found in my virtual env

I was working on project and had setup a virtualenv.我正在研究项目并设置了一个virtualenv。 Everything was working fine until severe got crashed.一切正常,直到严重崩溃。 When the server rebooted, I see all my installed packages in virtualenv is lost.当服务器重新启动时,我看到我在 virtualenv 中安装的所有软件包都丢失了。 When I try to install packages using "pip" I see "pip: command not found" error.当我尝试使用“pip”安装软件包时,我看到“pip: command not found”错误。 Later, I found that I have pip command is working outside of virtual env but not inside the virtual env.后来,我发现我有 pip 命令在虚拟环境之外工作,但不在虚拟环境内部。 I am not sure how to solve the pip issue.我不确定如何解决 pip 问题。 I have few questions which are as follows:我有几个问题如下:

  1. Do I need to set the path of pip inside virtual env to make it work?我是否需要在虚拟环境中设置 pip 的路径才能使其工作? if yes, how to set it up?如果是,如何设置?
  2. When I check my virtual env folder inside my repository I see the pip, pip3.... that means the virtual env has pip command but show how it is not able to call it.当我检查存储库中的虚拟 env 文件夹时,我看到 pip、pip3 .... 这意味着虚拟 env 具有 pip 命令,但显示它无法调用它。
  3. Should I delete my virtualenv and create new virtualenv?我应该删除我的 virtualenv 并创建新的 virtualenv 吗? If yes, how I may affect my existing code.如果是,我会如何影响我现有的代码。

Or is there any other way.或者有没有其他方法。 Any help would be appreciated.任何帮助,将不胜感激。 Thanks谢谢

# put conda on PATH like
. '/SOMEWHERE/conda/etc/profile.d/conda.sh'
# then
conda activate
# or look under conda\envs
conda env list
# if you were just using base I'd recommend a create
conda create -n environment_name
# yes then reinstall everything
conda activate environment_name

I like putting conda activate environment_name in an rc/profile depending on your terminal type as to where我喜欢根据您的终端类型将 conda activate environment_name 放在 rc/profile 中

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

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