English 中文(简体)
进出口:不能进口
原标题:ImportError: cannot import name CSafeLoader

Installed all the dependencies for juju

pip install pyparsing==1.5.7
pip install pyOpenSSL PyYAML txaws pydot oauth txzookeeper zc-zookeeper-static
pip install juju

所有已安装的罚款,但当我开始<代码>ju时,有以下错误:

(jujuapp) ± juju                                                                                           
Traceback (most recent call last):
  File "/Users/millisami/.virtualenvs/jujuapp/bin/juju", line 4, in <module>
    from juju.control import main
  File "/Users/millisami/.virtualenvs/jujuapp/lib/python2.7/site-packages/juju/control/__init__.py", line 7, in <module>
    from .utils import ParseError
  File "/Users/millisami/.virtualenvs/jujuapp/lib/python2.7/site-packages/juju/control/utils.py", line 8, in <module>
    from juju.state.environment import EnvironmentStateManager
  File "/Users/millisami/.virtualenvs/jujuapp/lib/python2.7/site-packages/juju/state/environment.py", line 8, in <module>
    from juju.environment.config import EnvironmentsConfig
  File "/Users/millisami/.virtualenvs/jujuapp/lib/python2.7/site-packages/juju/environment/config.py", line 8, in <module>
    from juju.lib import serializer
  File "/Users/millisami/.virtualenvs/jujuapp/lib/python2.7/site-packages/juju/lib/serializer.py", line 1, in <module>
    from yaml import CSafeLoader, CSafeDumper, Mark
ImportError: cannot import name CSafeLoader

What is this error? I m on Mac 10.6, python and pip installed via homebrew.

最佳回答

I just ran into this issue on 10.8; juju uses the libyaml bindings in PyYaml, so it needs to have PyYaml installed --with-libyaml, which requires more than that on the mac. Here s how I got it working:

  • brew install libyaml with homebrew
  • Download PyYaml source (instructions)

现在改为<代码>[pyyaml-install-dir]/制定。 类似:

# List of directories to search for  yaml.h  (separated by  : ).
include_dirs=/usr/local/Cellar/libyaml/0.1.4/include/

# List of directories to search for  libyaml.a  (separated by  : ).
library_dirs=/usr/local/Cellar/libyaml/0.1.4/lib/

So it can find your homebrew installation of libyaml. Then you also need to install Cython..

  • sudo pip install cython

and finally..

  • sudo python setup.py --with-libyaml install (in the PyYaml dir)

Now juju should work!

问题回答

面对2024年的问题:我的行动记录如下:

brew install libyaml
export LDFLAGS="-L/opt/homebrew/Cellar/libyaml/0.2.5/lib/"
export CFLAGS="-I/opt/homebrew/Cellar/libyaml/0.2.5/include/"

pip --no-cache-dir install --verbose --global-option= --with-libyaml  --force-reinstall -I pyyaml

然后 from yaml import CSafeLoader





相关问题
Curve fitting with lmfit for Mossbauer spectroscopy

Im pretty new to lmfit and I keep running into this error. My dataset is pretty large ~27000 points of data from I gather: my error msg import numpy as np import matplotlib.pyplot as plt from lmfit ...

Python SocketServer: sending to multiple clients?

Well, I m trying to build a small python prgram with a SocketServer that is supposed to send messages it receives to all connected clients. I m stuck, I don t know how to store clients on the ...

Is there no mysql connector for python 2.7 on windows

While I see a bunch of links/binaries for mysql connector for python 2.6, I don t see one for 2.7 To use django, should I just revert to 2.6 or is there a way out ? I m using windows 7 64bit django ...

How to update the image of a Tkinter Label widget?

I would like to be able to swap out an image on a Tkinter label, but I m not sure how to do it, except for replacing the widget itself. Currently, I can display an image like so: import Tkinter as ...

PyScripter for Python 2.7

How to run PyScripter if you have Python 2.7 installed? There is a command line parameter for Pyscipter to tell it which pythonXX.dll to use, but I can t get this working.

How to set time limit on raw_input

in python, is there a way to, while waiting for a user input, count time so that after, say 30 seconds, the raw_input() function is automatically skipped?

热门标签