在使用pip安装vectormath的时候

$ pip install vectormath

总是会报错

ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: /usr/local/lib/python2.7/dist-packages/vectormath

/home/kai/.local/lib/python2.7/site-packages/pip/_vendor/requests/init.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
warnings.warn(warning, RequestsDependencyWarning)
DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won’t be maintained after that date. A future version of pip will drop support for Python 2.7.
Collecting vectormath
Requirement already satisfied: numpy>=1.7 in ./.local/lib/python2.7/site-packages (from vectormath) (1.16.4)
Installing collected packages: vectormath
ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: ‘/usr/local/lib/python2.7/dist-packages/vectormath’
Consider using the --user option or check the permissions.

解决办法:

去官网直接下载python文件,然后使用suso拷贝/usr/local/lib/python2.7/dist-packages/vectormath到这个目录中

具体步骤如下:

step1:下载python文件

官网直达链接:vectormath · PyPI
https://pypi.org/project/vectormath/#files

step2:创建安装目录

$ cd /usr/local/lib/python2.7/dist-packages/
$ sudo mkdir vectormath

step3:移动vectormath文件

解压缩得到如下所示,这里的setup.py运行仍然是没有用的,很失望。

然后进入vectormath文件夹

将这两个文件移动到/usr/local/lib/python2.7/dist-packages/vectormath这个目录中

$ sudo cp __init__.py vector.py /usr/local/lib/python2.7/dist-packages/vectormath

step4:测试一个test_vectormath.py

$ gedit test_vectormath.py

输入

import numpy as np
import vectormath as vmath# Single Vectors
v = vmath.Vector3(5, 0, 0)
v.normalize()
print(v)                          # >> [1, 0, 0]
print(v.x)                        # >> 1.0# VectorArrays are much faster than a for loop over Vectors
v_array = vmath.Vector3Array([[4, 0, 0], [0, 2, 0], [0, 0, 3]])
print(v_array.x)                  # >> [4, 0, 0]
print(v_array.length)             # >> [4, 2, 3]
print(v_array.normalize())        # >> [[1, 0, 0], [0, 1, 0], [0, 0, 1]]
# Vectors can be accessed individually or in slices
print(type(v_array[1:]))          # >> vectormath.Vector3Array
print(type(v_array[2]))           # >> vectormath.Vector3# All these classes are just numpy arrays
print(isinstance(v, np.ndarray))  # >> True
print(type(v_array[1:, 1:]))      # >> numpy.ndarray

然后关闭保存运行:

$ python test_vectormath.py

正常运行的话会显示这些:

[1. 0. 0.]
1.0
[4. 0. 0.]
[4. 2. 3.]
[[1. 0. 0.][0. 1. 0.][0. 0. 1.]]
<class 'vectormath.vector.Vector3Array'>
<class 'vectormath.vector.Vector3'>
True
<type 'numpy.ndarray'>

Linux中vectormath无法通过pip安装的解决办法相关推荐

  1. Linux中buff/cache内存占用过高解决办法

    Linux中buff/cache内存占用过高解决办法 在Linux系统中,我们经常用free命令来查看系统内存的使用状态.在一个centos7的系统上,free命令的显示内容大概是这样一个状态: 这个 ...

  2. 【Linux】linux中某个命令找不到的解决办法

    问题 在linux系统中执行 php -v,提示: 解决办法: 1.查看当前系统的环境变量 php 安装好后,直接执行 php 时,系统首先会去/usr/bin下寻找命令,如果不在这个目录中,当然就会 ...

  3. Linux中error while loading shared libraries错误解决办法

    默认情况下,编译器只会使用/lib和/usr/lib这两个目录下的库文件,通常通过源码包进行安装时,如果不指定--prefix,会将库安装在/usr/local/lib目录下:当运行程序需要链接动态库 ...

  4. linux中overlay分区,Overlay空间不足的解决办法

    本帖最后由 griphin@qq.com 于 2020-1-18 16:47 编辑 重要事情说三遍: 用本文的办法增加overlay分区,会导致openwrt恢复成初始设置,所有的配置,都会丢失. 用 ...

  5. vsphere5.0环境中win2000虚机无法安装vmtools解决办法。

    需要安装补丁Windows2000-KB891861-v2-x86-CHS. http://download.microsoft.com/download/7/e/9/7e969f31-e33d-45 ...

  6. linux中实现pxe的自动安装

    linux中实现pxe的自动安装 什么是PXE PXE(preboot execute environment)是由Intel公司开发的最新技术,工作于Client/Server的网络模式,支持工作站 ...

  7. 在linux中,我为什么不能安装VMware Tools?

    在linux中,我为什么不能安装VMware Tools? 应该是操作不正确导致,以下为linux安装VMware Tools的方法. 1.在安装Linux的虚拟机中,单击"虚拟机" ...

  8. Linux中Docker的介绍、安装与卸载

    1.介绍 Docker是一个开源的应用容器引擎,诞生于2013年初,基于Go语言实现,dotCloud公司出品(后改名为Docker Inc).Docker可以让开发者打包他们的应用以及依赖包到一个轻 ...

  9. Linux中查看某个软件的安装路径

    Linux中查看某个软件的安装路径(地址)有时显得非常重要.比如某个文件的快速启动项被删除,或者你要建立快速启动项,或者想删除.添加安装文件等等,很多地方都要用到查案文件安装路径的命令. 这里给大家介 ...

最新文章

  1. Developer Express XtraGrid使用技巧
  2. 禁用浏览器滚动条的解决方案
  3. python写dnf游戏脚本辅助_HMM-维特比算法明白与实现(python)_dnf辅助,r6辅助
  4. 数据自治开放模式下的隐私保护
  5. linux下c语言线程传参数,【linux】C语言多线程中运行线程池,在线程池中运行线程池,,传递的结构体参数值为空/NULL/0...
  6. jieba分词,构建词典
  7. RDLC报表开发分组笔记
  8. es6解构--简化代码
  9. 使用electron开发指静脉客户端遇到的问题总结
  10. 错误与异常_2-7选择题
  11. python使用内置函数方法和桶排序方法实现随机数去重、排序输出
  12. 内存映射文件的优势劣势体会
  13. c语言流水灯循环左移程序,51单片机流水灯左移 右移控制程序
  14. 淘宝客微信发单机器人_返利机器人快速开发SDK
  15. 计算机专业口号 十六个字,霸气押韵16字班级口号(精选100句)
  16. 控制不住的数字沉溺之观《愿者上网》又名《监视资本主义:智能陷阱》后
  17. windows提升效率神器
  18. 来自Google的围棋AlphaGo
  19. CF1463-D. Pairs
  20. 清华教授:多年以来,我对我的学生都不太满意

热门文章

  1. Git工作笔记004---torisegit使用时Updates were rejected because the tip of your current branch i
  2. SpringColoud学习笔记007---杂七杂八001--@Resource与@Autowired注解的区别
  3. java面试要点---ibatiS框架的使用方法介绍---随时更新
  4. opencv 编译静态库
  5. 【OpenCV入门教程之一】 OpenCV 2.4.8 +VS2010的开发环境配置
  6. boost学习之简介
  7. python中scrapy加请求头_Python爬虫之scrapy框架随机请求头中间件的设置
  8. 如何释放hdfs中的续租_装修中甲醛如何高效释放
  9. linux登录用户目录,linux命令
  10. 使用java如何访问报表服务器_Java访问远程http服务器上数据的简便方法