在系统里 /usr/bin/ 中有 Python3.3 和 Python3.7 两个 py 版本,在创建 venv 时,如何指定 Python3.3 或 Python3.7 呢?
官方文档里也没找到说明,这个命令能指定 Python3.* 的小版本吗?
python3 -m venv /path/venv
1
raycool 347 天前
python3 这个引用的是哪个版本创建的就是哪个吧
|
![]() |
2
rrfeng 347 天前 ![]() python3.3 -m venv
python3.7 -m venv |
![]() |
3
hyfc 347 天前
-p PYTHON_EXE, --python=PYTHON_EXE
The Python interpreter to use, e.g., --python=python3.5 will use the python3.5 interpreter to create the new environment. The default is the interpreter that virtualenv was installed with (/usr/bin/python2) |
![]() |
5
hyfc 347 天前
使用 python3 内置 venv 库的话,就按照 2 楼的方法指定解释器版本。如果用 virtualenv 命令行,可以用-p 参数
|
6
xpresslink 347 天前
如果默认要用 3.7 可以创建一个软连接
# rm /usr/bin/python3 # ln -s /usr/bin/python3.7 /usr/bin/python3 |
![]() |
7
wellsc 347 天前
$ whereis python
$ /pathto/python3.7 -m venv ./somevenv |
![]() |
8
Mark24 347 天前
|
9
laike9m 347 天前
|
10
ruanimal 347 天前
使用绝对路径启动 python 吧
|
![]() |
11
chenglushe 346 天前
在?为什么不用 pyenv ?
|