[英]ModuleNotFoundError: No module named 'virtualenv.seed.via_app_data
I had installed virtualenv by sudo -H pip3 install virtualenv
, and created a venv by virtualenv, but now I can't create env in my new Django project that includes Pipfile .我已经通过
sudo -H pip3 install virtualenv
,并通过 virtualenv 创建了一个 venv,但现在我无法在包含Pipfile的新Django项目中创建 env。 I tried:我试过:
$ pipenv shell
But its result is:但它的结果是:
Creating a virtualenv for this project...
Pipfile: /home/mostafa/py38/lib/python3.8/site-packages/carfix/Pipfile
Using /usr/bin/python3.8 (3.8.5) to create virtualenv...
⠹ Creating virtual environment...ModuleNotFoundError: No module named 'virtualenv.seed.via_app_data'
✘ Failed creating virtual environment
I tried these answers but the problem is not yet resolved:我尝试了这些答案,但问题尚未解决:
The solution is to remove the installed virtualenv using解决方案是使用删除已安装的 virtualenv
pip3 uninstall virtualenv
pip3 卸载 virtualenv
And use the default installation of virtualenv then :然后使用 virtualenv 的默认安装:
pipenv shell
pipenv 外壳
Try to remove your virtualenv installation and try to install it via:尝试删除您的 virtualenv 安装并尝试通过以下方式安装它:
sudo apt-get install virtualenv
. sudo apt-get install virtualenv
。
Then create virtualenv with:然后使用以下命令创建 virtualenv:
virtualenv virtualenv_dir
Where virtualenv_dir is your Django project folder其中 virtualenv_dir 是您的 Django 项目文件夹
I finally found the solution to the problem:我终于找到了解决问题的方法:
I Used poetry lockfor one app and everything worked fine!我为一个应用程序使用了诗歌锁,一切正常!
I Used poetry lock for a second app and received the following error message:我将诗歌锁用于第二个应用程序并收到以下错误消息:
$ poetry lock
Creating virtualenv mytestapp-vm7OCEgV-py3.8 in /home/alexb7217/.cache/pypoetry/virtualenvs
ModuleNotFoundError
No module named 'virtualenv.seed.via_app_data'
at <frozen importlib._bootstrap>:973 in _find_and_load_unlocked
Followed the most simple suggestion:遵循了最简单的建议:
$ sudo apt remove --purge python3-virtualenv
Re-ran poetry-lock重跑诗锁
$ poetry lock
Updating dependenciesResolving dependencies... (1.1s)
Everything works great, that's it!一切都很好,就是这样! ;)
;)
I had the same issue.我遇到过同样的问题。 I was not able to select an existing environment nor create one.
我无法 select 现有环境,也无法创建环境。 What I did was to create one from the terminal:
我所做的是从终端创建一个:
virtualenv venv
get into it进入它
. venv/bin/activate
install the requirements I had, with pip3 no pip:安装我的要求,pip3 没有 pip:
pip3 install -r requirements.txt
and when I went back to pycharm, it asked me if I wanted to use that environment I just created.当我回到 pycharm 时,它问我是否要使用我刚刚创建的环境。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.