小编Sam*_*mmy的帖子

错误:无法创建'/Library/Python/2.7/site-packages/xlrd':权限被拒绝

我正在尝试在mac 10.8.4上安装xlrd,以便能够通过python读取excel文件.

我已按照http://www.simplistix.co.uk/presentations/python-excel.pdf上的说明进行操作

我这样做了:

  1. 将文件夹解压缩到桌面

  2. 在终端,cd到解压缩的文件夹

  3. $ python setup.py安装

这就是我得到的:

running install
running build
running build_py
creating build
creating build/lib
creating build/lib/xlrd
copying xlrd/__init__.py -> build/lib/xlrd
copying xlrd/biffh.py -> build/lib/xlrd
copying xlrd/book.py -> build/lib/xlrd
copying xlrd/compdoc.py -> build/lib/xlrd
copying xlrd/formatting.py -> build/lib/xlrd
copying xlrd/formula.py -> build/lib/xlrd
copying xlrd/info.py -> build/lib/xlrd
copying xlrd/licences.py -> build/lib/xlrd
copying xlrd/sheet.py -> build/lib/xlrd
copying xlrd/timemachine.py -> build/lib/xlrd
copying xlrd/xldate.py -> build/lib/xlrd
copying xlrd/xlsx.py -> build/lib/xlrd
creating build/lib/xlrd/doc
copying xlrd/doc/compdoc.html -> build/lib/xlrd/doc
copying xlrd/doc/xlrd.html …
Run Code Online (Sandbox Code Playgroud)

python installation xlrd

41
推荐指数
2
解决办法
7万
查看次数

用macports安装scipy时出现问题

我是编程和尝试导入scipy的新手.

问题:

当我尝试在终端中的python解释器中导入scipy时,它看起来像这样:

[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import scipy
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named scipy
>>> 
Run Code Online (Sandbox Code Playgroud)

我似乎正确安装了macports.我可以像上面一样成功导入numpy.

我最初根据http://www.scipy.org/install.html上的"macports"说明安装了scipy

即:

sudo port install py27-numpy py27-scipy py27-matplotlib py27-ipython +notebook py27-pandas py27-sympy py27-nose
Run Code Online (Sandbox Code Playgroud)

我也遵循了这篇文章: Python不会识别MacPorts安装的软件包

但似乎无法为自己找到答案

澄清:

当我运行"哪个python"时,我得到了

/usr/bin/python
Run Code Online (Sandbox Code Playgroud)

当我运行"端口内容py27-packagename"时,我得到了

Port py27-packagename is not installed.
Run Code Online (Sandbox Code Playgroud)

提前致谢

installation macports scipy python-2.7

4
推荐指数
1
解决办法
3593
查看次数

重新调整不止一件事有什么问题? - 来自python函数

作为这篇文章的后续跟进:

如何从Python中的函数返回多个值?

一个单独的问题:

作为一名初学程序员,我被教导只从函数中返回一个东西.

一个.返回多个东西有什么隐藏的问题吗?

湾 如果是这样,并且我想从一个长函数返回2个列表(即不调用2个单独的类似函数),那么从列表中创建一个元组有什么问题吗?

谢谢

python function

2
推荐指数
1
解决办法
164
查看次数

分配给多维数组

我有一个零的3d数组,我想用1d数组填充它:

In [136]: C = np.zeros((3,5,6),dtype=int)

In [137]: C
Out[137]: 
array([[[0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0]],

       [[0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, 0, 0]],

       [[0, 0, 0, 0, 0, 0],
        [0, 0, 0, 0, …
Run Code Online (Sandbox Code Playgroud)

python arrays numpy

2
推荐指数
1
解决办法
203
查看次数

标签 统计

python ×3

installation ×2

arrays ×1

function ×1

macports ×1

numpy ×1

python-2.7 ×1

scipy ×1

xlrd ×1