问题描述
我是 Python 新手,我正在尝试为我的项目添加一个新环境,该环境在我当前的环境 Python 3.7.5 上运行良好 添加所有依赖项后,我遇到了 pyttsx3 包的问题(对于 python 文本到语音) 在进一步研究后,我发现这是 python 版本 Python 3.7.6 的问题 https://github.com/nateshmbhat/pyttsx3/issues/136
这是我当前虚拟环境的 python 版本。 这些是我安装环境所遵循的步骤
- py -m pip install --user virtualenv
- py -m venv env
- 激活:.\env\Scripts\activate
https://packaging.python.org/guides/installing-using-pip-and-virtual-environments/
我希望我可以为我的虚拟环境获取 Python 3.7.7 或 Python 3.7.5(在我当前的机器上)。
我使用的是 Visual Studiocode IDE。
解决方法
你可以做到
virtualenv -p python3.7.5 [name]
但是你需要在你的 python3.7.5
中有 $PATH
否则你会得到
RuntimeError: failed to find interpreter for Builtin discover of python_spec='python3.7.5'
所以,你最好使用 conda
conda create --name [name] python=3.7.5