我已成功安装pyenv
并创建了虚拟环境:
$ pyenv virtualenv 3.6.3 venv
$ pyenv activate venv
$ pip install -r requirements.txt
所有先前的操作都允许在带有 Ubuntu 的 Windows 10 Linux 子系统中成功安装 nodeenv
。
然后,我按照在互联网上找到的一些说明正确安装 nodeenv
设置:
$ pyenv deactivate
$ pyenv activate venv
$ nodeenv -p
nodeenv -p
假设将 nodeenv virtualenv
绑定(bind)到 pyenv virtualenv
。这在我的工作笔记本电脑上工作,但在我的个人笔记本电脑上停止工作。以下是事件的顺序:
$ pyenv activate server363
$ pyenv-virtualenv: prompt changing will be removed from future release. configure 'export PYENV_VIRTUALENV_DISABLE_PROMPT=1' to simulate the behavior.
$ nodeenv -p
* Install prebuilt node (9.11.1) ..... done.
* Appending data to /home/fbenavides/.pyenv/versions/3.6.3/envs/server363/bin/activate
$ node -v
The program 'node' can be found in the following packages:
* node
* nodejs-legacy
Try: sudo apt-get install <selected package>
$ node -V
The program 'node' can be found in the following packages:
* node
* nodejs-legacy
Try: sudo apt-get install <selected package>
$ nodejs -v
The program 'nodejs' is currently not installed. You can install it by typing:
sudo apt-get install nodejs
$ nodejs -V
The program 'nodejs' is currently not installed. You can install it by typing:
sudo apt-get install nodejs
$ nodeenv -v
Usage: nodeenv [OPTIONS] ENV_DIR
nodeenv: error: You must provide a DEST_DIR or use current python virtualenv
$ nodeenv -V
Usage: nodeenv [OPTIONS] ENV_DIR
nodeenv: error: no such option: -V
我错过了什么吗?
最佳答案
Windows 10 Linux 子系统 Ubuntu 安装使用 .bashrc
文件来存储 pyenv
和 nodeenv
设置,这些设置需要在使用 nodeenv -p
命令有效安装 Node 服务器并将其绑定(bind)到 pyenv virtualenv 设置:
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
关于python - nodeenv -p 在 virtualenv 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49913208/