使用conda下载autopy和其他库

news2024/10/7 6:38:56

目录

一、前言

二、创建conda虚拟环境和下载库

1、创建conda虚拟环境

2、换源

(1)pip换源

(2)conda换源

3、下载库

4、下载超时处理方法(如果你的库比较大,比如pytorch)

5、用conda下载包找不到的解决方法

(1)搜索库

(2)找到对应版本

 (3)复制命令,进行下载

6、requirements.txt读取失败

7、autopy的下载报错!

三、总结


一、前言

  • 今天,跑一个手势识别的开源项目,半天没有下载好!
  • 就是因为作者没有表明版本号,呜呜呜!
  • 其中,autopy的只能在3.5~3.8可以用!(并且这里还有一个坑!)
  •  而我本地的是3.9,导致我得创建一个conda的虚拟环境(o(╥﹏╥)o)

 

二、创建conda虚拟环境和下载库

 

 不太会用可视化下载(舍弃)


1、创建conda虚拟环境

#------------------------------------基本操作
1.默认路径下创建新环境
conda create -n test python=3.7(name自己取名、python版本自己指定)

进阶:conda create --prefix=F:\condaenv\env_name python=3.7  #指定路径下创建环境

2.查看当前有哪些环境
conda env list

3.切换到新创建的环境
activate test  

4.退出当前环境
conda deactivate

5.删除环境
conda remove -n test --all

6、镜像源重置
conda config --remove-key channels

2、换源

(1)pip换源

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
pip config set install.trusted-host mirrors.aliyun.com

(2)conda换源

其实这一步没必要(但是也贴出来吧~),我们后面都用pip下载!

踩坑:国产镜像站执行conda install opencv会报错误,说在现在的源列表中找不到opencv

而且,不止opencv,还有很多库都找不到!!!

# 清华源:
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/menpo/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/

# 阿里源:
conda config --add channels https://mirrors.aliyun.com/anaconda/pkgs/free
conda config --add channels https://mirrors.aliyun.com/anaconda/pkgs/main
conda config --add channels https://mirrors.aliyun.com/anaconda/pkgs/msys2
conda config --add channels https://mirrors.aliyun.com/anaconda/pkgs/r
 
conda config --add channels https://mirrors.aliyun.com/anaconda/cloud/Paddle
conda config --add channels https://mirrors.aliyun.com/anaconda/cloud/auto
conda config --add channels https://mirrors.aliyun.com/anaconda/cloud/biobakery
conda config --add channels https://mirrors.aliyun.com/anaconda/cloud/bioconda
conda config --add channels https://mirrors.aliyun.com/anaconda/cloud/c4aarch64
conda config --add channels https://mirrors.aliyun.com/anaconda/cloud/caffe2
conda config --add channels https://mirrors.aliyun.com/anaconda/cloud/conda-forge
conda config --add channels https://mirrors.aliyun.com/anaconda/cloud/deepmodeling
conda config --add channels https://mirrors.aliyun.com/anaconda/cloud/dglteam
conda config --add channels https://mirrors.aliyun.com/anaconda/cloud/fastai
conda config --add channels https://mirrors.aliyun.com/anaconda/cloud/fermi
conda config --add channels https://mirrors.aliyun.com/anaconda/cloud/idaholab
conda config --add channels https://mirrors.aliyun.com/anaconda/cloud/intel
conda config --add channels https://mirrors.aliyun.com/anaconda/cloud/matsci
conda config --add channels https://mirrors.aliyun.com/anaconda/cloud/menpo
conda config --add channels https://mirrors.aliyun.com/anaconda/cloud/mordred-descriptor
conda config --add channels https://mirrors.aliyun.com/anaconda/cloud/msys2
conda config --add channels https://mirrors.aliyun.com/anaconda/cloud/numba
conda config --add channels https://mirrors.aliyun.com/anaconda/cloud/ohmeta
conda config --add channels https://mirrors.aliyun.com/anaconda/cloud/omnia
conda config --add channels https://mirrors.aliyun.com/anaconda/cloud/plotly
conda config --add channels https://mirrors.aliyun.com/anaconda/cloud/psi4
conda config --add channels https://mirrors.aliyun.com/anaconda/cloud/pytorch
conda config --add channels https://mirrors.aliyun.com/anaconda/cloud/pytorch-test
conda config --add channels https://mirrors.aliyun.com/anaconda/cloud/pytorch3d
conda config --add channels https://mirrors.aliyun.com/anaconda/cloud/pyviz
conda config --add channels https://mirrors.aliyun.com/anaconda/cloud/qiime2
conda config --add channels https://mirrors.aliyun.com/anaconda/cloud/rapidsai
conda config --add channels https://mirrors.aliyun.com/anaconda/cloud/rdkit
conda config --add channels https://mirrors.aliyun.com/anaconda/cloud/simpleitk
conda config --add channels https://mirrors.aliyun.com/anaconda/cloud/stackless
conda config --add channels https://mirrors.aliyun.com/anaconda/cloud/ursky
 
conda config --set show_channel_urls yes
# 镜像源重置
conda config --remove-key channels

3、下载库


# conda下载(源列表中经常有库找不到!)请用pip
conda install --file requirements.txt

# pip下载
pip install -r requirements.txt

问题:这个pip是conda里面的么?

是的,pip通常是conda环境中可用的一个软件包。当您使用conda创建并激活环境时,conda会自动包含pip作为环境的一部分。

在激活conda环境后,可以直接在命令行中使用pip。这个pip与系统中全局安装的pip实例是相互独立的,它将在当前激活的conda环境中操作。这样可以确保您使用的pip与conda环境中其他包的版本兼容。

因此,在conda环境中使用pip与使用系统全局的pip是不同的,它被限定在您当前激活的conda环境中。

踩坑:我一度以为这个pip下载会用我全局的pip下载,导致下载到我的全局pip文件中!呜呜呜!


一般情况下,这里安装完,就结束了!但是并没有,下面是遇到的坑的记录!!呜呜呜!


4、下载超时处理方法(如果你的库比较大,比如pytorch)

# conda下载设置时间(一般情况下,别用conda)
# 把连接超时的时间设置成40s,读取超时的时间修改成1000s
conda config --set remote_connect_timeout_secs 1000
conda config --set remote_read_timeout_secs 1000

# pip设置超时参数,加长时间
pip --default-timeout=1000 install name

5、用conda下载包找不到的解决方法

解决方法:去官网找对应版本的包(不推荐)

踩坑:当时看见conda报错,库找不到!!(报错如下)

(test) D:\pan\桌面\GestureInteraction-main>conda install --file 111.txt
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:

  - tf-estimator-nightly==2.8.0.dev2021122109
  - pycaw==20181226
  - pypiwin32==223
  - pyttsx3==2.90
  - mediapipe==0.8.9.1
  - autopy[version='>=4.0.0']
  - tensorflow==2.8.0
  - opt-einsum==3.3.0
  - opencv-contrib-python==4.5.5.64
  - opencv-python==4.5.5.64
  - tensorflow-io-gcs-filesystem==0.24.0

Current channels:

  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/win-64
  - https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/noarch


To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page

我竟然还傻乎乎的去https://anaconda.org 这个网址里面一个个找对应的版本,然后一个个执行下载命令!!!


(1)搜索库

(2)找到对应版本

 

 (3)复制命令,进行下载

 总结:conda下载太麻烦;还是用pip吧!!!


6、requirements.txt读取失败

因为编码不是UTF-8!

解决方法:

(方法1)自己创建一个记事本,把原来文件中的内容拷贝过去,保存就可以了!

(方法2)直接修改源文件的编码方式!

(test) D:\pan\桌面\GestureInteraction-main>conda install --file requirements.txt

CondaError: Error reading file, file should be a text file containing packages
conda create --help for details

7、autopy的下载报错!

Building wheels for collected packages: autopy
  Building wheel for autopy (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py bdist_wheel did not run successfully.
  │ exit code: 1
  ╰─> [20 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build\lib.win-amd64-cpython-39
      creating build\lib.win-amd64-cpython-39\autopy
      copying autopy\__init__.py -> build\lib.win-amd64-cpython-39\autopy
      running build_ext
      running build_rust
      error: can't find Rust compiler

      If you are using an outdated pip version, it is possible a prebuilt wheel is available for this package but pip is not able to install from it. Installing from the wheel would avoid the need for a Rust compiler.

      To update pip, run:

          pip install --upgrade pip

      and then retry package installation.

      If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for autopy
  Running setup.py clean for autopy
  error: subprocess-exited-with-error

  × python setup.py clean did not run successfully.
  │ exit code: 1
  ╰─> [17 lines of output]
      running clean
      removing 'build\lib.win-amd64-cpython-39' (and everything under it)
      'build\bdist.win-amd64' does not exist -- can't clean it
      'build\scripts-3.9' does not exist -- can't clean it
      removing 'build'
      running clean_rust
      error: can't find Rust compiler

      If you are using an outdated pip version, it is possible a prebuilt wheel is available for this package but pip is not able to install from it. Installing from the wheel would avoid the need for a Rust compiler.

      To update pip, run:

          pip install --upgrade pip

      and then retry package installation.

      If you did intend to build this package from source, try installing a Rust compiler from your system package manager and ensure it is on the PATH during installation. Alternatively, rustup (available at https://rustup.rs) is the recommended way to download and update the Rust compiler toolchain.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed cleaning build dir for autopy
Failed to build autopy
ERROR: Could not build wheels for autopy, which is required to install pyproject.toml-based projects

解决方法:下载【rust编译器】,重启【命令提示符】

(1)下载rust编译器

  • 从系统软件包管理器中安装Rust编译器,并确保它在安装过程中被添加到了系统的PATH环境变量中。(他可以自动给你添加)
  • 使用rustup工具链管理器(下载地址:rustup.rs - The Rust toolchain installer)下载和更新Rust编译器工具链。

 

 点击运行

 

 (2)重启命令提示符,继续用pip安装即可!

三、总结

1、conda创建虚拟环境后,用pip安装包!(别用conda)

2、当项目没有说明环境时,并且某些包就是按照不上,那么请注意python版本不兼容问题

3、有些包,需要下载额外的编译器,不用惊慌,根据提示下载就好

4、记得换源

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/751087.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

拓宽“主航道”的Serverless与EDA领域,亚马逊云科技不断创新开拓

在新潮如走马灯般变换的时尚界,每隔几年就会刮起一阵复古风。被誉为“时尚教父”的著名设计师安德烈莱昂塔利曾说:“时尚总是在寻找新的灵感和方向,而复古是其中一个重要的来源。” 无独有偶。日新月异的高科技领域也会出现公认的“过时”…

【六祎 - 前端】 前端设计系统组件的备忘录

设计系统按钮 设计痕迹导航可视化组建 进度条 汉堡菜单按钮 导航栏激活状态 状态颜色 web应用程序导航栏间距

可视化fcn-8s head的输出

"""可视化head的输出【可视化的结果是灰度图像"""image Image.open(imgPath).convert("RGB") transform transforms.Compose([transforms.ToTensor(),transforms.Normalize(mean[0.485, 0.456, 0.406], std[0.229, 0.224, 0.225]), …

SQL进阶(2)——SQL语句类型 增删改查CRUD 事务初步 表关联关系 视图 +索引

目录 引出SQL语句类型1.DML数据操纵语言(重点)2.DQL数据查询语言(重点)3.DDL(Data Definition Language了解)4.DCL(Data Control Language了解)5.TCL 事务控制语言 运算符和其他函数1.运算符2.其它函数增删改查CRUD 视图索引事务1…

springboot留守儿童爱心网站

本系统主要是设计出留守儿童爱心网站,基于B/S构架,后台数据库采用了Mysql,可以使数据的查询和存储变得更加有效,可以确保留守儿童爱心管理的工作能够正常、高效的进行,从而提高工作的效率。总体的研究内容如下&#xf…

迅捷录屏软件使用中的注意事项

取消勾选时就不会出现右侧的悬浮框滑动的窗口了。 取消鼠标高亮后,录制的视频就不会出现一个空心的小圆圈。

Python+docx实现python对word文档的编辑

前言: 该模块可以通过python代码来对word文档进行大批量的编辑。docx它提供了一组功能丰富的函数和方法,用于创建、修改和读取Word文档。下面是docx模块中一些常用的函数和方法的介绍: 安装:pip install docx 一、准备一个word文档…

计算机毕设 大数据房价数据分析及可视化 - python 房价分析

文章目录 1 课题背景2 数据爬取2.1 爬虫简介2.2 房价爬取 3 数据可视化分析3.1 ECharts3.2 相关可视化图表 4 最后 1 课题背景 房地产是促进我国经济持续增长的基础性、主导性产业。如何了解一个城市的房价的区域分布,或者不同的城市房价的区域差异。如何获取一个城…

声音生成项目(6)——在矢量量化变分编码器上使用自回归模型PixelCNN模型生成新的样本

文章目录 介绍PixelCNN论文简读模型介绍自回归模型PixelCNN模型结构 基础知识回顾参考连接 代码实现PixelConvLayer具体运行过程卷积模块整体网络结构 模型执行效果 Colab代码本子介绍Introduction介绍获取数据创建模型需要两个类 介绍 在上一篇就是介绍了矢量量化变分模型的具…

Stable Diffusion生成图片参数查看与抹除

前几天分享了几张Stable Diffusion生成的艺术二维码,有同学反映不知道怎么查看图片的参数信息,还有的同学问怎么保护自己的图片生成参数不会泄露,这篇文章就来专门分享如何查看和抹除图片的参数。 查看图片的生成参数 1、打开Stable Diffus…

LDAP Tool Box Self Service Password

手册地址:https://self-service-password.readthedocs.io/en/latest/安装要求: Apache or another web server php (>7.4) php-curl (haveibeenpwned api) php-filter php-gd (captcha) php-ldap php-mbstring (reset mail) php-openssl (token cryp…

管理类联考——数学——记忆篇——二、代数——5.不等式

文章目录 不等式均值不等式均值不等式定义一般情况下扩展 推导加深记忆 有公式就要用绝对值不等式一元二次不等式 不等式 不等式在初中、高中甚至竞赛中都是比较相对综合、有难度的一块内容,经常会与方程、函数等其它知识点一起考察,一般的题型有&#…

查看Elasticsearch集群状态

Elastic查询 使用elastic自带的开发工具查询 查询集群健康状态 #查询集群健康状态 GET /_cluster/health集群名字使我们创建容器的时候设置的参数,状态绿色 查询节点状态 #查询节点状态 GET /_cat/nodes?v我们是使用docker容器创建的,这里显示的ip是容器内部ip 查询索…

前端做excel的录入解析,将excel的数据传给后端,显示在页面上。

具体的流程如图所示: 1.点击excel录入按钮 2.打开弹框 3.点击上传按钮,会自动打开计算机本地文件,选择想上传的文件,点击打开 4.会将excel的数据解析成一个表格,可以在表格中做删除操作,点击确定 5.将exc…

DeFi新篇章 | Sui上原生订单簿DeepBook正式上线

随着原生去中心化中央限价订单簿( Central Limit Order Book,CLOB)DeepBook的推出,Sui上的DeFi开启了新篇章。DeepBook由一群Sui贡献者共同构建,为新一代DeFi应用提供了一个稳定的流动性层。 通过DeepBook&#xff0c…

Oracle select语法

SQL 语言介绍 SQL(Structured Query Language)为数据库的语言,在 1974 年由Boyce【博伊斯】和Chamberlin【钱伯林】提 出的一种介于关系代数与关系演算之间的结构化查询语言,是一个通用的、功能极强的关系型数据库语言。包含三部分 DDL(Data Definitio…

Spring Boot配置文件与日志

目录 配置文件配置文件格式.propertiesyml 读取配置文件内容根据不同环境配置不同属性 日志自定义日志的打印更简单的日志打印日志级别日志级别的设置 日志的持久化 配置文件 Spring Boot项目的重要数据都是在配置文件中设置的。配置文件可以包含各种属性和值,用于…

LeetCode_面试题 01.01. 判定字符是否唯一

题目描述 面试题 01.01. 判定字符是否唯一https://leetcode.cn/problems/is-unique-lcci/ 实现一个算法,确定一个字符串 s 的所有字符是否全都不同。 示例 1: 输入: s "leetcode" 输出: false 示例 2: 输入: s "abc"…

中国黄金品牌怎么代理

想选择一个项目创业其实不难,中国黄金这个品牌相信大家都已经相当的熟悉,它成立于1979年,是业界中的佼佼者,一直致力于为消费者提供黄金、白银、珠宝等的产品,无论是产品质量还是服务,都在行业中处于领先地…

数据备份、还原、视图、索引 操作练习

目录 备份与还原: 题目要求: 索引和视图 题目要求: 备份与还原: 在数据库booksDB中创建表books、authorbook、authorbook: 题目要求: 1、mysqldump -uroot -pRyh201314% booksDB > /backup/db/boo…