简体   繁体   English

无法通过python 3.4上运行的pip安装模块

[英]Cannot install modules via pip running on python 3.4

I have been trying to install various modules that I need to have to run this script: 我一直在尝试安装运行此脚本所需的各种模块:

https://github.com/austingandy/slack-evernote/blob/master/slackwriter.py https://github.com/austingandy/slack-evernote/blob/master/slackwriter.py

I am working off a Mac, and my python --version is: 我正在使用Mac,我的python --version是:

Python 3.4.3 :: Anaconda 2.3.0 (x86_64)

And I have for python -m pip --version : 我有python -m pip --version

pip 8.0.2 from /Users/dhruv/anaconda/lib/python3.4/site-packages (python 3.4)

However, for example when I run pip install evernote I get errors like: 但是,例如当我运行pip install evernote我得到的错误如下:

Collecting evernote
  Using cached evernote-1.25.1.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/cj/5gs43w4n2tz313rrnz9_htf00000gn/T/pip-build-0y7hm202/evernote/setup.py", line 6
        exec x
             ^
    SyntaxError: Missing parentheses in call to 'exec'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/cj/5gs43w4n2tz313rrnz9_htf00000gn/T/pip-build-0y7hm202/evernote

I have a feeling that these errors are because the setup.py code that pip has is in python 2.7 format, and my environment is 3.4, but how can I overall install all the packages I need to run this script? 我有一种感觉,这些错误是因为pip具有的setup.py代码是python 2.7格式,我的环境是3.4,但是如何整体安装运行此脚本所需的所有软件包呢? Would I change to python 2.7, install in that environment, and then repackage the setup of evernote into python 3.4 format? 我是否会更改为python 2.7,在该环境中安装,然后将evernote的设置重新打包为python 3.4格式? If so, how? 如果是这样,怎么样?

AFAIK, Evernote SDK for Python 3 is not yet supported. 尚不支持AFAIK,Evernote SDK for Python 3。

https://github.com/evernote/evernote-sdk-python3 https://github.com/evernote/evernote-sdk-python3

This is a test SDK! 这是一个测试SDK! The official Evernote SDK for Python doesn't support Python 3 yet; 官方的Evernote SDK for Python还不支持Python 3; this repository is an experiment as we try to migrate. 我们尝试迁移时,此存储库是一个实验。

You can try installing manually from the link above or downgrade to python2 in your virtual env. 您可以尝试从上面的链接手动安装或降级到虚拟环境中的python2。

While it is possible to migrate a script from Python 2 to Python 3, doing it right isn't trivial. 虽然可以将脚本从Python 2迁移到Python 3,但正确执行并非易事。 You could try using 2to3 but I suspect it won't quite do the job. 您可以尝试使用2to3,但我怀疑它不会完成这项工作。

The easiest is to just use virtualenv with Python 2. I'm not sure how it is on Mac but on Linux you can just have both versions of Python installed in parallel and you can pick the one you need in your virtualenv as eg 最简单的方法就是在Python 2上使用virtualenv 。我不确定它在Mac上是怎么回事,但是在Linux上你可以同时安装两个版本的Python,你可以在你的virtualenv中选择你需要的那个版本,例如:

virtualenv -p python2 venv

where python2 is your Python 2 binary and venev the directory you want tot install the virtualenv into. 其中python2是你的Python 2二进制文件,并且你想要将virtualenv安装到目录中。

Where you might run into trouble is the activate scripts which are only available for specific shells. 您可能遇到麻烦的地方是激活脚本,它们仅适用于特定的shell。 However, you could probably adapt one if none works out of the box. 但是,如果没有开箱即用,你可能会调整一个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM