简体   繁体   English

pyenv 使用系统 python 而不是虚拟环境

[英]pyenv is using system python instead of virtual environment

I've been using pyenv for a long time, without any troubles.我一直在使用 pyenv 很长一段时间,没有任何麻烦。 I set up it properly and everything worked.我正确设置了它,一切正常。

However, while I was trying to solve another problem, I run some line which ruined my pyenv instalation.然而,当我试图解决另一个问题时,我运行了一些破坏了我的 pyenv 安装的行。

Now, when I activate any virtualenv, it tries to use system's python instead of pyenv's:现在,当我激活任何 virtualenv 时,它会尝试使用系统的 python 而不是 pyenv 的:

$ pyenv activate foo
(foo) $ which python 
/usr/bin/python
(foo) $ pip --version
pip 20.3.4 from /home/rodrigo/.local/lib/python2.7/site-packages/pip (python 2.7)

I'm not sure exactly which line was the one that ruined it, it may be the following: (foo) $ pip install --upgrade pip setuptools wheel from the foo environment (I run it when it still worked), but may be another.我不确定到底是哪一行毁了它,它可能是以下内容: (foo) $ pip install --upgrade pip setuptools wheel from the foo环境(我在它仍然工作时运行它),但可能是其他。

I already checked ~/.bashrc file and it is ok;我已经检查了~/.bashrc文件,没问题; restarted the console and even changed to a different environment foo2 and the problem is still there...重新启动控制台,甚至更改为不同的环境foo2 ,问题仍然存在...

I already checked similar questions like this or this , but those are related to miss-configurations which I already tested and are ok.我已经检查过类似这样这样的问题,但那些与我已经测试过并且没问题的配置错误有关。

I'm using Ubuntu 18.04 LTS and pyenv 2.0.3-8-gad880754我使用的是 Ubuntu 18.04 LTS 和 pyenv 2.0.3-8-gad880754

UPDATE I re-installed pyenv but it still doesn't work更新我重新安装了 pyenv 但它仍然不起作用

I have the same problem as you,Finally changed vim ~/.zshrc it became easier to use我和你有同样的问题,终于改了vim ~/.zshrc 好用了

Change eval "$(pyenv init -)" to eval "$(pyenv init --path)" and start a new shell.将 eval "$(pyenv init -)" 更改为 eval "$(pyenv init --path)" 并启动一个新的 shell。

Seems like this was a change that was introduced in 2.0似乎这是 2.0 中引入的更改

暂无
暂无

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

相关问题 系统 Python 虚拟环境“发现”了 Anaconda 而不是 Python - 如何防止这种情况发生? - System Python virtual environment 'finds' the Anaconda Python instead - how to prevent this? 在虚拟环境(pyenv)下使用python 3.4.3安装OpenCV3.0 - Install OpenCV3.0 with python 3.4.3 under virtual environment (pyenv) 从控制台导入 Python 虚拟环境 (pyenv) 中的模块时出现段错误 - Segfault when importing modules in Python virtual environment (pyenv) from console pipenv 无法使用 pyenv python 3.8.0 创建虚拟环境 - pipenv fails to create virtual environment with pyenv python 3.8.0 错误ImportError:在使用pyenv的虚拟环境中没有名为“ encodings”的模块 - Error ImportError: No module named 'encodings' in virtual environment using pyenv 为什么虚拟环境运行系统Python 2.7而不是虚拟Python 3.6 - Why the virtual environment runs system Python 2.7 instead of virtual Python 3.6 用pyenv安装anaconda,无法配置虚拟环境 - Installing anaconda with pyenv, unable to configure virtual environment 如何使用pyenv在不同的python环境上安装依赖项 - How to install dependencies on different python environment using pyenv Python:如何在 pyenv-virtual-environment 中更新 python 版本? - Python: How can I update python version in pyenv-virtual-environment? 为什么每个虚拟环境在pyenv中使用(指向)相同的python版本? - Why do every virtual environment use(point) same python version in pyenv?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM