我正在尝试安装lxml.我看过这个网站,版本2.2.8对我来说看起来很合理,但是当我这样做时easy_install lxml,它安装了版本2.3.beta1,这不是我想要的我想要的.
解决此问题的最佳方法是什么?如何强制easy_install安装特定版本?
(Mac os x 10.6)
我想在Mac OS X 10.6.8上安装Python Pandas库(0.8.1).这个库需要Numpy> = 1.6.
我试过这个
$ sudo easy_install pandas
Searching for pandas
Reading http://pypi.python.org/simple/pandas/
Reading http://pandas.pydata.org
Reading http://pandas.sourceforge.net
Best match: pandas 0.8.1
Downloading http://pypi.python.org/packages/source/p/pandas/pandas-0.8.1.zip#md5=d2c5c5bea971cd760b0ae6f6850fcb74
Processing pandas-0.8.1.zip
Running pandas-0.8.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-ckAMym/pandas-0.8.1/egg-dist-tmp-0mlL7t
error: Setup script exited with pandas requires NumPy >= 1.6 due to datetime64 dependency
Run Code Online (Sandbox Code Playgroud)
所以我试着安装Numpy
$ sudo easy_install numpy
Searching for numpy
Best match: numpy 1.6.2
Adding numpy 1.6.2 to easy-install.pth file
Using /Library/Python/2.6/site-packages
Processing dependencies for numpy
Finished processing dependencies for numpy
Run Code Online (Sandbox Code Playgroud)
所以我又试了一次
$ …Run Code Online (Sandbox Code Playgroud) 我在Mac上,我安装numpy,并sklearn按照这个顺序.现在,我遇到了几次已经提到的这些错误:
sklearn"numpy.dtype具有错误的大小,尝试重新编译"pycharm和终端
ValueError:numpy.dtype的大小错误,请尝试重新编译
从sklearn导入时导入:无法导入名称check_build
因此,我尝试通过卸载numpy并重新安装以前的版本来修复此错误.
1)sudo pip install --upgrade numpy..给予权限错误
...OSError: [Errno 1] Operation not permitted: '/tmp/pip-OVY0Vq-uninstall/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy-1.8.0rc1-py2.7.egg-info'...
2)我试过了brew uninstall numpy,但是import numpy在shell重启后仍然可以工作.
我能想到的唯一一件事就是手动删除所有numpy文件,这些文件在Mac上可以找到
sudo rm -rf /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy
....但即便如此,也会给我一个许可错误.是什么赋予了?
我采用了新的OSX 10.9.3全新安装并安装了pip,然后做了
pip install pandas pip install numpy
两个安装似乎都非常高兴,并且运行没有任何错误(尽管有很多警告).当我尝试使用导入pandas运行python脚本时,我收到以下错误:
numpy.dtype has the wrong size, try recompiling Traceback (most recent call last):
File "./moen.py", line 7, in import pandas File "/Library/Python/2.7/site-packages/pandas/__init__.py", line 6, in from . import hashtable, tslib, lib
File "numpy.pxd", line 157, in init pandas.hashtable (pandas/hashtable.c:22331)
ValueError: numpy.dtype has the wrong size, try recompiling
如何修复此错误并正确加载pandas?
我在容器中使用pandas,我收到以下错误:
Traceback (most recent call last):
File "/volumes/dependencies/site-packages/celery/app/trace.py", line 374, in trace_task
R = retval = fun(*args, **kwargs)
File "/volumes/dependencies/site-packages/celery/app/trace.py", line 629, in __protected_call__
return self.run(*args, **kwargs)
File "/volumes/code/autoai/celery/data_template/api.py", line 16, in run_data_template_task
data_template.run(data_bundle, columns=columns)
File "/volumes/code/autoai/models/data_template.py", line 504, in run
self.to_parquet(data_bundle, columns=columns)
File "/volumes/code/autoai/models/data_template.py", line 162, in to_parquet
}, parquet_path=data_file.path, directory="", dataset=self)
File "/volumes/code/autoai/core/datasets/parquet_converter.py", line 46, in convert
file_system.write_dataframe(parquet_path, chunk, directory, append=append)
File "/volumes/code/autoai/core/file_systems.py", line 76, in write_dataframe
append=append)
File "/volumes/dependencies/site-packages/pandas/core/frame.py", line 1945, in to_parquet
compression=compression, **kwargs)
File "/volumes/dependencies/site-packages/pandas/io/parquet.py", …Run Code Online (Sandbox Code Playgroud) 我试图在我的Linux Mint 12上安装scikit-learn但是失败了.我从http://pypi.python.org/pypi/scikit-learn/下载了该软件包并安装了
sudo python2.7 setup.py install
Run Code Online (Sandbox Code Playgroud)
然后我将目录更改为home并启动了python2.7 shell.在导入sklearn时我得到了:
>>> import sklearn
/usr/lib/python2.7/dist-packages/scipy/spatial/__init__.py:7: RuntimeWarning:
numpy.dtype size changed, may indicate binary incompatibility
from ckdtree import *
/usr/lib/python2.7/dist-packages/scipy/spatial/__init__.py:7: RuntimeWarning:
numpy.ndarray size changed, may indicate binary incompatibility
from ckdtree import *
/usr/lib/python2.7/dist-packages/scipy/spatial/__init__.py:7: RuntimeWarning:
numpy.ufunc size changed, may indicate binary incompatibility
from ckdtree import *
/usr/lib/python2.7/dist-packages/scipy/spatial/__init__.py:8: RuntimeWarning:
numpy.dtype size changed, may indicate binary incompatibility
from qhull import *
/usr/lib/python2.7/dist-packages/scipy/spatial/__init__.py:8: RuntimeWarning:
numpy.ndarray size changed, may indicate binary incompatibility
from qhull import *
/usr/lib/python2.7/dist-packages/scipy/spatial/__init__.py:8: …Run Code Online (Sandbox Code Playgroud) 我有给定的Python代码,我在PyCharm的venv中使用它.
from keras.applications.resnet50 import ResNet50
from keras.preprocessing import image
from keras.applications.resnet50 import preprocess_input, decode_predictions
import numpy as np
print (np.__version__)
Run Code Online (Sandbox Code Playgroud)
代码抛出以下异常:
File "type.pxd", line 9, in init mtrand
ValueError: builtins.type has the wrong size, try recompiling. Expected 840, got 864
PyDev console: starting.
Python 3.5.0a4 (v3.5.0a4:413e0e0004f4, Apr 19 2015, 18:01:47) [MSC v.1900 64 bit (AMD64)] on win32
Run Code Online (Sandbox Code Playgroud)
我已经看过这个类似的主题, 我在描述中升级了所有内容:
pip install --upgrade numpy
pip install --upgrade scipy
pip install --upgrade pandas
Run Code Online (Sandbox Code Playgroud)
此外还有特定的熊猫版本.
pip install pandas==0.13.1
Run Code Online (Sandbox Code Playgroud)
我仍然得到同样的例外.你还有其他建议吗?提前致谢
python ×7
numpy ×5
pandas ×4
easy-install ×2
importerror ×1
macos ×1
pip ×1
pycharm ×1
python-2.7 ×1
scikit-learn ×1
version ×1