[英]I'm not able create virtual environment using virtualenv
C:\Users\NAVEEN\Desktop\Demo>virtualenv venv
Traceback (most recent call last):
File "c:\users\naveen\appdata\local\programs\python\python38\lib\runpy.py", line 192, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\naveen\appdata\local\programs\python\python38\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\NAVEEN\AppData\Local\Programs\Python\Python38\Scripts\virtualenv.exe\__main__.py", line 4, in <module>
File "c:\users\naveen\appdata\local\programs\python\python38\lib\site-packages\virtualenv\__init__.py", line 3, in <module>
from .run import cli_run
File "c:\users\naveen\appdata\local\programs\python\python38\lib\site-packages\virtualenv\run\__init__.py", line 12, in <module>
from .plugin.activators import ActivationSelector
File "c:\users\naveen\appdata\local\programs\python\python38\lib\site-packages\virtualenv\run\plugin\activators.py", line 6, in <module>
from .base import ComponentBuilder
File "c:\users\naveen\appdata\local\programs\python\python38\lib\site-packages\virtualenv\run\plugin\base.py", line 7, in <module>
from importlib.metadata import entry_points
ModuleNotFoundError: No module named 'importlib.metadata'
In Python 3.6+, the pyvenv module is deprecated.Your python interpreter version is 3.8.在 Python 3.6+ 中,不推荐使用 pyvenv 模块。您的Python 解释器版本是3.8。
Use the following one-liner instead:请改用以下单行:
python3 -m venv <myenvname>
Python already ships with its builtin "virtualenv" called venv since version 3.3.
自 3.3 版以来,Python 已经附带了称为 venv 的内置“virtualenv”。 You no longer need to install or download the virtualenv scripts for Python 3.3+.
您不再需要为 Python 3.3+ 安装或下载 virtualenv 脚本。
Refer the doc for more and Another stackOverflow Answer有关更多信息和另一个 stackOverflow 答案,请参阅文档
You want to write it like this:你想这样写:
python -m venv {virtualenv}
replace '{virtualenv}' with the name you want your virtual environment to have.将“{virtualenv}”替换为您希望虚拟环境具有的名称。
首先安装 virtualenv 使用 comand pip install virtualenv 或 pip3 install virtualenv(for linux) 然后你可以创建一个 venv 你可以使用 comand virtualenv --version 检查版本 ov virtualenv
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.