nodeenv -p在virtualenv中不起作用

时间:2018-04-19 05:17:38

标签: python node.js virtualenv pyenv

我已成功安装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 virtualenvpyenv virtualenv联系起来。这适用于我的工作笔记本电脑,但停止在我的笔记本电脑上工作Heres是一系列事件:

$ 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

我错过了什么吗?

1 个答案:

答案 0 :(得分:1)

Windows 10 Linux子系统Ubuntu安装使用.bashrc文件来存储pyenvnodeenv设置,这些设置需要正确设置才能使nodeenv -p命令有效地安装节点服务器并将其绑定到pyenv virtualenv设置:

export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"