简体   繁体   English

ModuleNotFoundError:当我通过 virtualenv 创建新环境时,没有名为“virtualenv.seed.embed.via_app_data”的模块

[英]ModuleNotFoundError: No module named 'virtualenv.seed.embed.via_app_data' when I created new env by virtualenv

I had install virtualenv, created a venv by virtualenv since last month but now I can't create other env.我已经安装了 virtualenv,自上个月以来通过 virtualenv 创建了一个 venv,但现在我无法创建其他 env。 In Ubuntu 20.04 terminal, I had tried:在 Ubuntu 20.04 终端中,我尝试过:

$virtualenv my_env

But its result is但它的结果是

ModuleNotFoundError: No module named 'virtualenv.seed.embed.via_app_data'

After that, I checked its version:之后,我检查了它的版本:

$virtualenv --version

and get:并得到:

virtualenv 20.0.17 from /usr/lib/python3/dist-packages/virtualenv/__init__.py

I also checked it by $pip3 list and virtualenv still exists.我还通过 $pip3 list 检查了它,virtualenv 仍然存在。 It seem that problem came after I had install Anaconda.在我安装 Anaconda 之后似乎出现了问题。

@yushulx I also ran into the same issue. @yushulx 我也遇到了同样的问题。 I installed both via pip3 and via sudo apt install python3-virtualenv and it gave me an error but after I ran pip3 uninstall virtualenv I could create a virtualenv without issue我通过pip3sudo apt install python3-virtualenv了它,它给了我一个错误,但是在我运行pip3 uninstall virtualenv之后,我可以毫无问题地创建一个 virtualenv

Try to create the virtual environment using directly venv module尝试直接使用 venv 模块创建虚拟环境

python3 -m venv my_env

To fix this on Ubuntu 20.04, I had to uninstall virtualenv from the system: apt remove python3-virtualenv , and reinstall it using pip : pip install --user virtualenv --force-reinstall .要在 Ubuntu 20.04 上修复此问题,我必须从系统中卸载virtualenvapt remove python3-virtualenv ,然后使用pip重新安装: pip install --user virtualenv --force-reinstall I had errors about dependencies conflicts, I fixed them by calling pip install --user ${package} --force-reinstall for every package involved.我有关于依赖冲突的错误,我通过调用pip install --user ${package} --force-reinstall来修复它们,为每个涉及的 package 调用。

virtualenv is installed by default with python itself and when you install virtualenv via pip3 and try to create virtual environment using pipenv you will get this error: virtualenv默认与 python 一起安装,当您通过pip3安装virtualenv并尝试使用pipenv创建虚拟环境时,您将收到此错误:

ModuleNotFoundError: No module named 'virtualenv.seed.embed.via_app_data

check the version of installed virtualenv using apt list --installed mine is:使用apt list --installed mine 检查已安装virtualenv的版本:

python3-virtualenv/focal,focal,now 20.0.17-1 all [installed,automatic] with the installed virtualenv by pip3 min is: python3-virtualenv/focal,focal,now 20.0.17-1 all [installed,automatic]pip3 min 安装的virtualenv是:

virtualenv             20.4.0

default installation of virtualenv is different with pip3 installed virtualenv so when you try to create a virtual environment using pipenv for example installing django in a directory home/user/djano with pipenv install django~=3.1.5 you will get that error the solution is remove installed virtualenv using pip3 uninstall virtualenv and use the default installation of virtualenv this time when you create virtual environment with pipenv it will create it successfully. virtualenv的默认安装与pip3安装的virtualenv不同,因此当您尝试使用pipenv创建虚拟环境时,例如使用pipenv install django~=3.1.5home/user/djano目录中安装 django 时,您将收到该错误,解决方案是使用 pip3 删除已安装的virtualenv pip3 uninstall virtualenv并使用默认安装的virtualenv这次当您使用pipenv创建虚拟环境时,它将成功创建它。

I want to have virtualenvwrapper .我想要virtualenvwrapper On Debian 10 testing I did:Debian 10 testing中我做了:

apt remove python3-virtualenvwrapper  # not purge, I want no changes in ~/.virtualenvs/
apt purge python3-virtualenv
/usr/bin/python3.8 -m pip install --force-reinstall virtualenvwrapper
/usr/bin/python3.8 -m pip install --force-reinstall virtualenv==20.0.23

.24 no longer works. .24不再有效。 I hope it will be solved sometimes...我希望它有时会得到解决...

EDIT 2021.01 : I have changed my stack to: pyenv + pyenv-virtualenvwrapper + poetry .编辑 2021.01 :我已将堆栈更改为: pyenv + pyenv-virtualenvwrapper + poetry Ie. IE。 I use no apt or pip installation of virtualenv or virtualenvwrapper, and instead I install pyenv 's plugin pyenv-virtualenvwrapper .我不使用 apt 或 pip 安装 virtualenv 或 virtualenvwrapper,而是安装pyenv的插件pyenv-virtualenvwrapper This is easier way.这是更简单的方法。

If someone encounters this problem inside existing env (when for example using pyenv) you can also use command below (found on GitHub when tried to fix poetry virtual env installation):如果有人在现有环境中遇到此问题(例如使用 pyenv 时),您还可以使用以下命令(在尝试修复诗歌虚拟环境安装时在GitHub上找到):

pip install --force-reinstall virtualenv

When I installed virtualenv via pip3 , it failed to run virtualenv command.当我通过pip3安装virtualenv时,它无法运行virtualenv命令。 Then I changed the installation via:然后我通过以下方式更改了安装:

sudo apt install python3-virtualenv

The virtualenv command can normally work. virtualenv命令可以正常工作。

I too had this issue.我也有这个问题。 What I found is it is a permissions issue.我发现这是一个权限问题。 For some unknown reason ownership of my home directory was off.由于某些未知原因,我的主目录的所有权已关闭。 I did a chown -R for the directory I was using for my project making myself the owner of my own directory and now everything works as normal.我为我的项目使用的目录做了一个chown -R ,使自己成为我自己目录的所有者,现在一切正常。

I also had same issue, seems installed version has different user level so I followed their doc and below one work for me:我也有同样的问题,似乎安装的版本有不同的用户级别,所以我按照他们的文档和下面的一项为我工作:

python3 -m virtualenv --help

To create new environment:创建新环境:

python3 -m virtualenv my_env

Use sudo with the command.将 sudo 与命令一起使用。

sudo virtualenv my_env

It means that there are two virtualenv in your system.这意味着您的系统中有两个 virtualenv。 One is "pip install" by sudo or root, the other may be installed by apt(if you are using ubuntu os) Just uninstall one of them and the error should be fixed.一种是sudo或root的“pip install”,另一种可能是apt安装(如果您使用的是ubuntu os)只需卸载其中一个即可修复错误。

I fixed this error by removing all virtualenv and virtualenvwrapper related packages on system and reinstall the virtualenv and virtualenvwrapper with pip with below command(as i use ubuntu, so below only show apt) remove all packages shown in below result我通过删除系统上的所有 virtualenv 和 virtualenvwrapper 相关包来修复此错误,并使用以下命令重新安装带有 pip 的 virtualenv 和 virtualenvwrapper(因为我使用 ubuntu,所以下面只显示 apt)删除下面结果中显示的所有包

apt list --installed | grep virtualenvwrapper 
apt list --installed | grep virtualenvwrapper 

install virtualenv virtualenvwrapper with pip使用 pip 安装 virtualenv virtualenvwrapper

pip install virtualenvwrapper virtualenvwrapper 

set ~/.zshrc设置 ~/.zshrc

export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/amd
export VIRTUALENVWRAPPER_SCRIPT=/home/robot/.local/bin/virtualenvwrapper.sh
export VIRTUALENVWRAPPER_PYTHON=$(which python3)
source /home/robot/.local/bin/virtualenvwrapper.sh

I also faced the same issue but after removing virtualenv which was installed with pip3 , I could get rid of this error.我也遇到了同样的问题,但是在删除了pip3安装的virtualenv之后,我可以摆脱这个错误。 Uninstall virtualenv with below command (don't forget to use sudo)使用以下命令卸载 virtualenv(不要忘记使用 sudo)

sudo pip3 uninstall virtualenv

After this, virtualenv command works totally fine.在此之后, virtualenv 命令工作得很好。

When we use pip3 or python3 to install virtualenv then I got that error too.当我们使用 pip3 或 python3 安装virtualenv时,我也遇到了这个错误。 I had to run each time to create virtualenv (my_env is virtual environment name)我每次都必须运行来创建 virtualenv(my_env 是虚拟环境名称)

python3 -m virtualenv my_env

But if I install it using但是如果我安装它使用

sudo apt install virtualenv

Then virtualenv command works fine.然后virtualenv命令工作正常。

virtualenv my_env

暂无
暂无

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

相关问题 ModuleNotFoundError:没有名为“virtualenv.seed.via_app_data”的模块 - ModuleNotFoundError: No module named 'virtualenv.seed.via_app_data Python3 virtualenv 安装失败:没有名为“virtualenv.seed.via_app_data”的模块 - Python3 virtualenv installation borked: No module named 'virtualenv.seed.via_app_data' virtualenv - ModuleNotFoundError:没有名为“django”的模块? - virtualenv - ModuleNotFoundError: No module named 'django'? ModuleNotFoundError:virtualenv 中没有名为“_tkinter”的模块 - ModuleNotFoundError: No module named '_tkinter' within virtualenv 安装了virtualenv,但仍然出现“ ModuleNotFoundError:没有名为“ virtualenv”的模块”错误 - Installed virtualenv, but still getting “ModuleNotFoundError: No module named 'virtualenv'” error ModuleNotFoundError:没有带有virtualenv和python3.7.4的名为“ rest-framework”的模块 - ModuleNotFoundError: No module named 'rest-framework' with virtualenv and python3.7.4 创建 env 时找不到 VirtualEnv 模块 - VirtualEnv Module not found when creating env python3 create virtualenv 发现错误“ModuleNotFoundError: No module named '_ctypes'” - python3 create virtualenv found error "ModuleNotFoundError: No module named '_ctypes'" ModuleNotFoundError: 没有用 virtualenv 命名的模块,需要了解如何为生产构建它 - ModuleNotFoundError: No module named with virtualenv and need understanding how to structure it for production 没有名为contextlib的模块? 在virtualenv中? - No module named contextlib? in a virtualenv?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM