您的位置:首页 > 其它

pip在anaconda环境下指定安装路径的安装问题

2018-01-04 15:24 741 查看
错误起因:

pip安装torchtext==0.1.1完成后,发现安装路径为.local/lib/python3.6/site-packages,但是我的程序需要使用python2.7。

一次改正:

指定pip安装路径重新安装$ pip install --user --install-option="-prefix=./.local/lib/python2.7" torchtext==0.1.1 

安装不成功

/users4/zsun/anaconda3/lib/python3.6/site-packages/pip/commands/install.py:194: UserWarning: Disabling all use of wheels due to the use of --build-options / --global-options / --install-options.

  cmdoptions.check_install_build_global(options)

Requirement already satisfied: torchtext==0.1.1 in /users4/zsun/.local/lib/python3.6/site-packages

Requirement already satisfied: requests in /users4/zsun/anaconda3/lib/python3.6/site-packages (from torchtext==0.1.1)

Requirement already satisfied: tqdm in /users4/zsun/.local/lib/python3.6/site-packages (from torchtext==0.1.1)

Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /users4/zsun/anaconda3/lib/python3.6/site-packages (from requests->torchtext==0.1.1)

Requirement already satisfied: idna<2.7,>=2.5 in /users4/zsun/anaconda3/lib/python3.6/site-packages (from requests->torchtext==0.1.1)

Requirement already satisfied: urllib3<1.23,>=1.21.1 in /users4/zsun/anaconda3/lib/python3.6/site-packages (from requests->torchtext==0.1.1)

Requirement already satisfied: certifi>=2017.4.17 in /users4/zsun/anaconda3/lib/python3.6/site-packages (from requests->torchtext==0.1.1)

发现安装不成功 ,并可发现/anaconda3/lib/python3.6/site-packages/pip/commands/install.py为pip的安装目录。

我的anaconda是基于python3安装的,所以接下来

二次改正:

为我的anacoda添加python2 的环境,操作流程http://www.lqkweb.com/blog.php?id=86

安装好py27之后,source activate py27开启py27。(关闭:
deactivate


此时find -name python2.7发现除了必须有的./.local/lib/python2.7还出现众多类似于./anaconda3/envs/py27/bin/python2.7的。

下一步重新尝试$ pip install --user --install-option="-prefix=./anaconda3/envs/py27/lib/python2.7" torchtext==0.1.1

安装成功。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐