【发布时间】:2016-04-12 13:12:51
【问题描述】:
我在尝试使用 pip install 在 python 中下载和运行包时遇到问题。通常 pip 会告诉我我已经下载了包,但是当我尝试使用该功能时,它会给我一个错误并说“没有这样的文件或目录”。在我看来,我使用的是 2.7.10,这就是 pip 尝试安装的地方,但我不明白为什么这不起作用
Peters-MBP:~ pete$ python import plotly
/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file 'import': [Errno 2] No such file or directory
Peters-MBP:~ pete$ pip install plotly
Requirement already satisfied (use --upgrade to upgrade): plotly in ./Library/Python/2.7/lib/python/site-packages
Collecting pytz (from plotly)
Using cached pytz-2016.3-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): requests in ./Library/Python/2.7/lib/python/site-packages (from plotly)
Collecting six (from plotly)
Using cached six-1.10.0-py2.py3-none-any.whl
Installing collected packages: pytz, six
Successfully installed pytz-2016.3 six-1.10.0
You are using pip version 8.1.0, however version 8.1.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Peters-MBP:~ pete$ python --version
Python 2.7.10
Peters-MBP:~ pete$ python
Python 2.7.10 (v2.7.10:15c95b7d81dc, May 23 2015, 09:33:12)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
【问题讨论】:
-
又名
f***d up environment。尝试重新安装 python 和 pip。 -
你在使用 virtualenvs 吗?
-
不,伙计们,没那么复杂。看看他在做什么:他试图在 shell 提示符下执行
python import plotly!! -
所以这个搞砸的环境有点像我一直在想的。那么我应该卸载我电脑上所有与python相关的东西,然后重新安装所有这些吗?
-
@PWalton 阅读下面我和 Marco 发布的答案。你不能做你想做的事。很可能,您的 Python 安装没问题。
标签: python python-2.7 pip packages plotly