gpt4 book ai didi

python - 无法使用 mkvirtualenv, "site-packages/_markerlib"权限被拒绝

转载 作者:行者123 更新时间:2023-11-30 23:29:25 24 4
gpt4 key购买 nike

编辑,这似乎是一般权限问题:

The installation directory you specified (via --install-dir, --prefix, or the distutils default setting) was:
/Library/Python/2.7/site-packages/
Perhaps your account does not have write access to this directory?
<小时/>

我发现了这个问题,这正是我的问题,但我没有 ~/.pydistutils.cfg 文件:

virtualenv: could not create '/lib/python2.7': Permission denied

我也确实安装了 setuptools 和命令行工具,如下所述:Error when ex mkvirtualenv in Mountain Lion

我用 sudo 安装了所有东西,但我不能在这里使用 sudo:

sudo: mkvirtualenv: command not found

回溯:

mkvirtualenv myenv
......stuff here......

build/lib/setuptools/_backport/hashlib
running install_lib
creating /Library/Python/2.7/site-packages/_markerlib
error: could not create '/Library/Python/2.7/site-packages/_markerlib': Permission denied
----------------------------------------
...Installing Setuptools...done.
Traceback (most recent call last):
File "/usr/local/bin/virtualenv", line 8, in <module>
load_entry_point('virtualenv==1.10.1', 'console_scripts', 'virtualenv')()
File "/Library/Python/2.7/site-packages/virtualenv.py", line 821, in main
symlink=options.symlink)
File "/Library/Python/2.7/site-packages/virtualenv.py", line 961, in create_environment
install_sdist('Setuptools', 'setuptools-*.tar.gz', py_executable, search_dirs)
File "/Library/Python/2.7/site-packages/virtualenv.py", line 932, in install_sdist
filter_stdout=filter_install_output)
File "/Library/Python/2.7/site-packages/virtualenv.py", line 899, in call_subprocess
% (cmd_desc, proc.returncode))
OSError: Command /Users/cbron/.virtualenvs/sam/bin/python setup.py install --single-version-externally-managed --record record failed with error code 1

最佳答案

sudo chown -R your-username:wheel /Library/Python/2.7/site-packages

您可能需要 chmod 目录的权限和/或卸载并重新安装 virtualenv:

sudo pip uninstall virtualenv
sudo pip uninstall virtualenvwrapper
sudo pip install virtualenv
sudo pip install virtualenvwrapper
echo "source `which virtualenvwrapper.sh`" >> ~/.bash_profile
. ~/.bash_profile

关于python - 无法使用 mkvirtualenv, "site-packages/_markerlib"权限被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21194519/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com