sách gpt4 ăn đã đi

python - Anaconda:无法导入 pylab

In lại 作者:太空狗 更新时间:2023-10-29 20:54:17 30 4
mua khóa gpt4 giày nike

我无法使用最新版本的 Anaconda导入 pylab (Linux 64 位)。其他包似乎工作正常。 (注意:我没有 su-đu-t 访问权限)

In [1]: import pylab as pl
-------------------------------------------------- -------------------------
ImportError Traceback (most recent call last)
in ()
----> 1 import pylab as pl

/home/josh/installs/conda/1.7.0/lib/python2.7/site-packages/pylab.py in ()
----> 1 from matplotlib.pylab import *
2 import matplotlib.pylab
3 __doc__ = matplotlib.pylab.__doc__

/home/josh/installs/conda/1.7.0/lib/python2.7/site-packages/matplotlib/pylab.py in ()
267 from numpy.linalg import *
268
--> 269 from matplotlib.pyplot import *
270
271 # provide the recommended module abbrevs in the pylab namespace

/home/josh/installs/conda/1.7.0/lib/python2.7/site-packages/matplotlib/pyplot.py in ()
96
97 from matplotlib.backends import pylab_setup
---> 98 _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
99
100

/home/josh/installs/conda/1.7.0/lib/python2.7/site-packages/matplotlib/backends/__init__.pyc in pylab_setup()
23 backend_name = 'matplotlib.backends.%s'%backend_name.lower()
24 backend_mod = __import__(backend_name,
---> 25 globals(),locals(),[backend_name])
26
27 # Things we pull in from all backends

/home/josh/installs/conda/1.7.0/lib/python2.7/site-packages/matplotlib/backends/backend_qt4agg.py in ()
11
12 from backend_agg import FigureCanvasAgg
---> 13 from backend_qt4 import QtCore, QtGui, FigureManagerQT, FigureCanvasQT,\
14 show, draw_if_interactive, backend_version, \
15 NavigationToolbar2QT

/home/josh/installs/conda/1.7.0/lib/python2.7/site-packages/matplotlib/backends/backend_qt4.py in ()
23 figureoptions = None
24
---> 25 from qt4_compat import QtCore, QtGui, _getSaveFileName, __version__
26
27 backend_version = __version__

/home/josh/installs/conda/1.7.0/lib/python2.7/site-packages/matplotlib/backends/qt4_compat.py in ()
34 # Now perform the imports.
35 if QT_API in (QT_API_PYQT, QT_API_PYQTv2):
---> 36 import sip
37 if QT_API == QT_API_PYQTv2:
38 if QT_API_ENV == 'pyqt':

ImportError: No module named sip

如果我尝试

> conda install sip 

我得到:

Error: No packages found matching: sip

我也遇到错误:

$ pip install sip 1 
Downloading/unpacking sip
You are installing a potentially insecure and unverifiable file. Future v
ersions of pip will default to disallowing insecure files.
Downloading sip-4.15.2.zip (899kB): 899kB downloaded
Running setup.py egg_info for package sip
Theo dõi (cuộc gọi gần đây nhất là cuộc gọi cuối cùng):
File "", line 16, in
IOError: [Errno 2] No such file or directory: '/tmp/pip_build_josh/
sip/setup.py'
Complete output from command python setup.py egg_info:
Theo dõi (cuộc gọi gần đây nhất là cuộc gọi cuối cùng):

File "", line 16, in

IOError: [Errno 2] No such file or directory: '/tmp/pip_build_josh/sip/
setup.py'

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build
_josh/sip
Storing complete log in /home/josh/.pip/pip.log

Có ý tưởng gì không?

câu trả lời hay nhất

刚遇到这个问题,它与 matplotlib 尝试使用的 qt 后端有关,尝试:

import PyQt4

如果你没有 PyQt4,你可能有 PySide

import PySide

如果是这种情况,您需要设置 matplotlib.rcParams['backend.qt4'] == 'PySide' thay vì 'PyQt4'。您也可以在 matplotlibrc 文件中执行此操作 (~/.matplotlib/matplotlibrc)

# find and change line:
backend.qt4 : PySide

注意:如果您没有 matplotlibrc 文件,您可以从 matplotlib 源目录中复制它

nhập khẩu chúng
import matplotlib
mpl_dir = os.path.dirname(matplotlib.__file__)
os.system("cp {}/mpl-data/matplotlibrc ~/.matplotlib/".format(mpl_dir))

关于python - Anaconda:无法导入 pylab,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19231944/

30 4 0
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress