在系统里 /usr/bin/ 中有 Python3.3 和 Python3.7 两个 py 版本,在创建 venv 时,如何指定 Python3.3 或 Python3.7 呢?
官方文档里也没找到说明,这个命令能指定 Python3.* 的小版本吗?
python3 -m venv /path/venv
1
raycool Apr 29, 2020
python3 这个引用的是哪个版本创建的就是哪个吧
|
2
rrfeng Apr 29, 2020 python3.3 -m venv
python3.7 -m venv |
3
hyfc Apr 29, 2020
-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 Apr 29, 2020
使用 python3 内置 venv 库的话,就按照 2 楼的方法指定解释器版本。如果用 virtualenv 命令行,可以用-p 参数
|
6
xpresslink Apr 29, 2020
如果默认要用 3.7 可以创建一个软连接
# rm /usr/bin/python3 # ln -s /usr/bin/python3.7 /usr/bin/python3 |
7
wellsc Apr 29, 2020
$ whereis python
$ /pathto/python3.7 -m venv ./somevenv |
8
Mark24 Apr 29, 2020
|
9
laike9m Apr 29, 2020
|
10
ruanimal Apr 29, 2020
使用绝对路径启动 python 吧
|
11
chenglus Apr 30, 2020
在?为什么不用 pyenv ?
|