pip安装软件

环境:macOS Sierra 10.12.6

工具:pycharm 2017.3.2

sudo easy_install pip

出现错误,于是用另一种方法安装

还是会出现问题

Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/var/folders/0t/t7t2dpdx1xb825__kxqdl26h0000gn/T/pip-build-JwqJfi/pyqrcode/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/0t/t7t2dpdx1xb825__kxqdl26h0000gn/T/pip-LvXj4Y-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/0t/t7t2dpdx1xb825__kxqdl26h0000gn/T/pip-build-JwqJfi/pyqrcode/

参考https://stackoverflow.com/questions/31498495/error-when-installing-using-pip

输入命令

sudo pip install -U setuptools

依旧报错

The directory '/Users/imac/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/imac/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

最后用以下命令行解决

sudo -H pip install itchat

itchart替换成你要安装的软件名称就可以了。

 

转载于:https://www.cnblogs.com/qianyindichang/p/8311651.html

### 解决 PyCharm 社区版无法通过 pip 安装包的问题 当遇到 PyCharm 社区版无法使用 `pip` 安装第三方库的情况时,通常是因为网络连接问题或默认的 `pip` 源配置不当所致。以下是详细的解决方案: #### 更新 pip 版本 确保使用的 `pip` 是最新版本有助于减少兼容性和性能方面的问题。可以通过命令行更新 `pip`: ```bash python -m pip install --upgrade pip ``` 这条指令会自动检测并升级当前环境中的 `pip` 到最新的稳定版本[^4]。 #### 更改 pip 源地址 如果仍然存在安装失败的情况,则可能是由于默认的 pypi.org 源访问不稳定引起。此时建议切换到更稳定的国内镜像源来加速下载过程以及提高成功率。例如阿里云提供的 Python 镜像服务就可以作为一个很好的替代选项之一: ```bash pip install <package_name> -i https://mirrors.aliyun.com/pypi/simple/ ``` 对于特定的例子来说,如果是尝试安装 `pylint` 这样的工具,完整的命令应该是这样的形式: ```bash pip install pylint -i https://mirrors.aliyun.com/pypi/simple/ ``` 这将强制 `pip` 使用指定的 URL 来查找和获取所需资源文件[^3]。 #### 设置持久性的 pip 源更改 为了长期解决问题而不必每次都手动输入额外参数,在用户的 home 目录下创建或编辑 `.pip/pip.conf` 文件(Windows 用户可以在 `%APPDATA%\pip\pip.ini`),加入如下内容以实现永久改变默认索引网址设置: ```ini [global] index-url = https://mirrors.aliyun.com/pypi/simple/ ``` 这样以后每次执行 `pip install` 命令都会自动采用新的镜像站点作为数据来源。 #### 在 PyCharm 中管理解释器路径与虚拟环境 另外值得注意的是,在 PyCharm 内部也可以方便地管理和修改项目的 Python 解释器及其关联的依赖项列表。具体操作是在 IDE 的偏好设置里找到 Project Interpreter 页面,这里不仅可以查看已有的库还可以直接在线搜索并添加缺失的部分;同时支持一键创建独立于全局系统的临时工作空间——即所谓的 Virtualenv 或 Conda Environment ——从而更好地隔离不同项目之间的相互影响[^1]。 通过上述方法应该能够有效解决大多数情况下 PyCharm 社区版中遇到的 `pip` 安装难题。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值