我在没有root访问权限的共享主机(siteground)上。我试图创建一个虚拟环境。以下是我到目前为止所做的事情:
# Download pip
wget https://bootstrap.pypa.io/get-pip.py
# install pip in my user directory
python get-pip.py --user
# add local path in my .bash_profile
PATH=$PATH:~/.local/bin
export PATH
# source it
source .bash_profile
# install virtualenv in my user directory
pip install --user virtualenv
# check that virtualenv was installed correctly
virtualenv --version
# 15.1.0
# attempt to create a virtual environment
cd ~/dev/
mkdir venvtest
cd venvtest
virtualenv -v venvtest
这样做,我收到以下错误消息:
Creating /home/blahblah/dev/venvtest/venvtest/lib/python2.7
Symlinking Python bootstrap modules
Traceback (most recent call last):
File "/home/blahblah/.local/bin/virtualenv", line 11, in <module>
sys.exit(main())
File "/home/blahblah/.local/lib/python2.7/site-packages/virtualenv.py", line 713, in main
symlink=options.symlink)
File "/home/blahblah/.local/lib/python2.7/site-packages/virtualenv.py", line 925, in create_environment
site_packages=site_packages, clear=clear, symlink=symlink))
File "/home/blahblah/.local/lib/python2.7/site-packages/virtualenv.py", line 1127, in install_python
for fn in os.listdir(stdlib_dir):
OSError: [Errno 13] Permission denied: '/chroot/python27/lib/python2.7'
知道我应该采取哪些不同的做法?非常感谢!
答案 0 :(得分:2)
有两种情况: 1)主机管理员设置了一组非常严格的权限,在这种情况下,除了联系他们并告诉他们您的问题之外,您无能为力。 2)您正在尝试在具有错误权限的目录中创建virtualenv。尝试移动到 / tmp 目录。