【发布时间】:2017-11-17 01:29:54
【问题描述】:
不知何故,我的 Python/Conda/Pip 安装是这样的,即使在活动的 conda 环境中运行时,pip 也会尝试安装到全局站点包目录。
在运行 10.12.4 的 macbook pro 上,我可以通过以下方式重现:
- 创建 conda 环境:
$conda create -n test python=3.6 - 激活 conda 环境:
$source activate test - 验证 pip 命令是否引用了正确的 pip 二进制文件:
$which pip /Users/ethankeller/anaconda3/envs/test/bin/pip - 使用 pip 安装任何包 - 例如 numpy:
$pip install numpy Collecting numpy Using cached numpy-1.13.0-cp36-cp36m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl Installing collected packages: numpy Exception: Traceback (most recent call last): File "/Users/ethankeller/anaconda3/envs/test/lib/python3.6/site-packages/pip/basecommand.py", line 215, in main status = self.run(options, args) File "/Users/ethankeller/anaconda3/envs/test/lib/python3.6/site-packages/pip/commands/install.py", line 342, in run prefix=options.prefix_path, File "/Users/ethankeller/anaconda3/envs/test/lib/python3.6/site-packages/pip/req/req_set.py", line 784, in install **kwargs File "/Users/ethankeller/anaconda3/envs/test/lib/python3.6/site-packages/pip/req/req_install.py", line 851, in install self.move_wheel_files(self.source_dir, root=root, prefix=prefix) File "/Users/ethankeller/anaconda3/envs/test/lib/python3.6/site-packages/pip/req/req_install.py", line 1064, in move_wheel_files isolated=self.isolated, File "/Users/ethankeller/anaconda3/envs/test/lib/python3.6/site-packages/pip/wheel.py", line 345, in move_wheel_files clobber(source, lib_dir, True) File "/Users/ethankeller/anaconda3/envs/test/lib/python3.6/site-packages/pip/wheel.py", line 316, in clobber ensure_dir(destdir) File "/Users/ethankeller/anaconda3/envs/test/lib/python3.6/site-packages/pip/utils/__init__.py", line 83, in ensure_dir os.makedirs(path) File "/Users/ethankeller/anaconda3/envs/test/lib/python3.6/os.py", line 220, in makedirs mkdir(name, mode) PermissionError: [Errno 13] Permission denied: '/lib/python3.6/site-packages/numpy'
我想某些环境变量以某种方式设置错误......关于可能出现什么问题或从哪里开始查找的任何建议?
【问题讨论】: