我正在尝试通过ssh在远程计算机上设置python环境(没有root访问权限)。我按照以下说明操作:
下载virtualenv脚本: wget -O /tmp/virtualenv.py https://raw.github.com/pypa/virtualenv/master/virtualenv.py
运行虚拟环境脚本
python /tmp/virtualenv.py $HOME/pyenv/
将在$ HOME空间的“pyenv”目录中设置环境
如果你正在使用bash(我希望你这样做),那么你应该添加:
. $HOME/pyenv/bin/activate
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/ioa//lib:/usr/local/lib64
to your .bashrc
当我运行python /tmp/virtualenv.py $ HOME / pyenv /时,我收到错误
New python executable in /home/lht26/pyenv/bin/python
Cannot find a wheel for setuptools
Cannot find a wheel for pip
Installing setuptools, pip, wheel...
Complete output from command /home/lht26/pyenv/bin/python - setuptools pip wheel:
Traceback (most recent call last):
File "<stdin>", line 7, in <module>
ImportError: No module named pip
...Installing setuptools, pip, wheel...done.
Traceback (most recent call last):
File "/tmp/virtualenv.py", line 2328, in <module>
main()
File "/tmp/virtualenv.py", line 713, in main
symlink=options.symlink)
File "/tmp/virtualenv.py", line 945, in create_environment
download=download,
File "/tmp/virtualenv.py", line 901, in install_wheel
call_subprocess(cmd, show_stdout=False, extra_env=env, stdin=SCRIPT)
File "/tmp/virtualenv.py", line 797, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /home/lht26/pyenv/bin/python - setuptools pip wheel failed with error code 1
我该怎么办?
答案 0 :(得分:2)
以下是运行virtualenv的步骤。
首先,安装pip(pip3,如果你有3个版本的python):
sudo apt-get install python-pip
然后运行以下命令:
sudo pip install virtualenv
mkdir myproject
cd myproject
virtualenv venv
. venv/bin/activate