Python 3.3和在Mac上安装PyOpenSSL [英] Python 3.3 and Installing PyOpenSSL on a Mac

查看:285
本文介绍了Python 3.3和在Mac上安装PyOpenSSL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有python 3.3,可以运行一些基本代码(例如print("Hello World")).接下来,我需要设置PyOpenSSL.我已经从他们的github网站下载了pyOpenSSL-master.zip并解压缩了,但是我不知道下一步该怎么做.

I have python 3.3 working and can run some basic code (like print("Hello World")). Next I need so get PyOpenSSL set up. I've downloaded and unzipped the pyOpenSSL-master.zip from their github site, but I have no idea what to do with it next.

我将解压缩的目录移到了/libs,将cd移到了/libs/pyopenssl-master,然后执行了python setup.py install --user.但这失败了

I moved the unzipped directory into /libs, cd into /libs/pyopenssl-master and did python setup.py install --user. But that failed with

/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'setup.py': [Errno 2] No such file or directory

除了目录不存在(我认为安装程序会创建该目录)之外,更大的问题是它似乎正在尝试写入python 2.7文件夹,而我正在使用3.3.

Other than the directory not existing, which I assume that the installer would create, the bigger problem is that it appears to be trying to write to the python 2.7 folder and I'm using 3.3.

如果您不能告诉我,我的能力已经远远超出了我的水平.我以前从未安装过Python库,并且对OSX的安装也不满意.任何人都可以帮助我进行此设置吗?谢谢.

If you can't tell, I'm pretty much out of my element. I've never installed a Python library before and I'm also not great with OSX installations. Can anyone help me get this set up? Thanks.

推荐答案

以下是在OS X(或几乎任何其他平台)上安装pyOpenSSL的方法:

Here's how you can install pyOpenSSL on OS X (or just about any other platform):

  1. 安装点子
  1. 使用适用于您的操作系统的软件包进行安装.例如,如果您使用brew,则brew install pip.
  2. 如果没有适用于您操作系统的软件包,请下载 https ://raw.github.com/pypa/pip/master/contrib/get-pip.py
  3. 运行它(不幸的是,可能是root用户):sudo python get-pip.py
  1. Install it using a package for your operating system. For example, if you use brew, brew install pip.
  2. If there is no package for your operating system, download https://raw.github.com/pypa/pip/master/contrib/get-pip.py
  3. Run it (probably as root, unfortunately): sudo python get-pip.py

  • 使用pip安装virtualenv-pip install --user virtualenv
  • 创建一个virtualenv将pyOpenSSL安装到-virtualenv ~/Environments/pyOpenSSL-stuff
  • 激活virtualenv-. ~/Environments/pyOpenSSL-stuff/bin/activate
  • 使用pip安装pyOpenSSL-pip install pyopenssl
  • Install virtualenv using pip - pip install --user virtualenv
  • Create a virtualenv to install pyOpenSSL into - virtualenv ~/Environments/pyOpenSSL-stuff
  • Activate the virtualenv - . ~/Environments/pyOpenSSL-stuff/bin/activate
  • Install pyOpenSSL with pip - pip install pyopenssl
  • 这时,您已经在virtualenv中安装了pyOpenSSL.每当您要使用pyOpenSSL时,都需要激活virtualenv.我建议您实际上为您从事的的每个项目创建一个virtualenv,并将每个项目的所有必要依赖项安装到该项目的virtualenv中.

    At this point you have pyOpenSSL installed in a virtualenv. Any time you want to use pyOpenSSL you'll need to activate the virtualenv. I suggest that you actually create a virtualenv for each project of yours that you work on and install all of the necessary dependencies for each project into that project's virtualenv.

    这确实导致大量重复安装软件包.不幸的是,这似乎是Python软件包安装的最新技术.幸运的是,大多数Python软件包都很小.

    This does result in a lot of duplicate installations of packages. Unfortunately this seems to be the state of the art for Python package installation. Fortunately most Python packages are rather small.

    这篇关于Python 3.3和在Mac上安装PyOpenSSL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆