我有四个不同的文件:main,vector,entity和physics.我不会发布所有代码,只发布导入,因为我认为这就是错误所在.(如果你愿意,我可以发布更多)
主要:
import time
from entity import Ent
from vector import Vect
#the rest just creates an entity and prints the result of movement
Run Code Online (Sandbox Code Playgroud)
实体:
from vector import Vect
from physics import Physics
class Ent:
#holds vector information and id
def tick(self, dt):
#this is where physics changes the velocity and position vectors
Run Code Online (Sandbox Code Playgroud)
向量:
from math import *
class Vect:
#holds i, j, k, and does vector math
Run Code Online (Sandbox Code Playgroud)
物理:
from entity import Ent
class Physics:
#physics class gets an entity …Run Code Online (Sandbox Code Playgroud) 我在Raspberry Pi上的Occidentalis操作系统(Raspbian的一个变种)上安装了OpenCV,使用了jayrambhia的脚本:https://github.com/jayrambhia/Install-OpenCV/blob/master/Ubuntu/opencv_latest.sh.它安装了2.4.5版本.
当我尝试在python程序中导入模块cv2时,我收到以下消息:
pi@raspberrypi~$ python cam.py
Traceback (most recent call last)
File "cam.py", line 1, in <module>
import cv2
ImportError: No module named cv2
Run Code Online (Sandbox Code Playgroud)
cv2.so存储在
pi@raspberrypi~$ python cam.py
Traceback (most recent call last)
File "cam.py", line 1, in <module>
import cv2
ImportError: No module named cv2
Run Code Online (Sandbox Code Playgroud)
在/ usr/local/lib中还有一些名为python3.2和python2.6的文件夹,这可能是个问题,但我不确定.
这可能是路径错误吗?任何帮助(Linux新手).
谢谢.
我正在使用Python并使用Flask.当我在我的电脑上运行我的主要的Python文件,它完美的作品,但是当我启动VENV和运行在终端的瓶的Python文件,它说,我的主要的Python文件中有"无模块命名BS4." 非常感谢任何意见或建议.
我在这里关注Flask教程:
http://blog.miguelgrinberg.com/post/the-flask-mega-tutorial-part-i-hello-world
我到达了尝试./run.py的地步,我得到:
Traceback (most recent call last):
File "./run.py", line 3, in <module>
from app import app
File "/Users/benjaminclayman/Desktop/microblog/app/__init__.py", line 1, in <module>
from flask import Flask
ImportError: No module named flask
Run Code Online (Sandbox Code Playgroud)
这看起来类似于:
但他们的解决方案没有帮助.作为参考,我也有这一个用户提到可能会导致问题的文件夹命名的烧瓶中.
我注意到使用基本操作系统Alpine与CentOS或Debian在Docker容器中安装Pandas和Numpy(它的依赖关系)需要更长的时间.我在下面创建了一个小测试来演示时差.除了Alpine更新和下载构建依赖项以安装Pandas和Numpy的几秒钟之外,为什么setup.py需要比Debian安装多70倍的时间?
有没有办法加速使用Alpine作为基本图像的安装,或者是否有另一个与Alpine相当的基本图像,最好用于像Pandas和Numpy这样的软件包?
Dockerfile.debian
FROM python:3.6.4-slim-jessie
RUN pip install pandas
Run Code Online (Sandbox Code Playgroud)
使用Pandas&Numpy构建Debian映像:
[PandasDockerTest] time docker build -t debian-pandas -f Dockerfile.debian . --no-cache
Sending build context to Docker daemon 3.072kB
Step 1/2 : FROM python:3.6.4-slim-jessie
---> 43431c5410f3
Step 2/2 : RUN pip install pandas
---> Running in 2e4c030f8051
Collecting pandas
Downloading pandas-0.22.0-cp36-cp36m-manylinux1_x86_64.whl (26.2MB)
Collecting numpy>=1.9.0 (from pandas)
Downloading numpy-1.14.1-cp36-cp36m-manylinux1_x86_64.whl (12.2MB)
Collecting pytz>=2011k (from pandas)
Downloading pytz-2018.3-py2.py3-none-any.whl (509kB)
Collecting python-dateutil>=2 (from pandas)
Downloading python_dateutil-2.6.1-py2.py3-none-any.whl (194kB)
Collecting six>=1.5 (from python-dateutil>=2->pandas)
Downloading six-1.11.0-py2.py3-none-any.whl
Installing collected packages: …Run Code Online (Sandbox Code Playgroud) 在安装openerp 6的过程时,我想用这个命令生成一个配置文件,
cd/home/openerp/openerp-server/bin /
./openerp-server.py -s --stop-after-init -c /home/openerp/openerp-server.cfg
但它总是显示出一个信息
ImportError: No module named psycopg2
当我检查psycopg2包时,它已经安装好,
包python-psycopg2-2.4.5-1.rhel5.x86_64已安装和最新版本
没事做
这有什么问题?我的服务器是centos,我安装了python 2.6.7.
真的需要你的帮助..
当我开始金字塔pserve时,我得到了这个堆栈跟踪:
% python $(which pserve) ../etc/development.ini
Traceback (most recent call last):
File "/home/hughdbrown/.local/bin/pserve", line 9, in <module>
load_entry_point('pyramid==1.5', 'console_scripts', 'pserve')()
File "/home/hughdbrown/.virtualenvs/ponder/local/lib/python2.7/site-packages/pyramid-1.5-py2.7.egg/pyramid/scripts/pserve.py", line 51, in main
return command.run()
File "/home/hughdbrown/.virtualenvs/ponder/local/lib/python2.7/site-packages/pyramid-1.5-py2.7.egg/pyramid/scripts/pserve.py", line 316, in run
global_conf=vars)
File "/home/hughdbrown/.virtualenvs/ponder/local/lib/python2.7/site-packages/pyramid-1.5-py2.7.egg/pyramid/scripts/pserve.py", line 340, in loadapp
return loadapp(app_spec, name=name, relative_to=relative_to, **kw)
File "/home/hughdbrown/.virtualenvs/ponder/lib/python2.7/site-packages/PasteDeploy-1.5.2-py2.7.egg/paste/deploy/loadwsgi.py", line 247, in loadapp
return loadobj(APP, uri, name=name, **kw)
File "/home/hughdbrown/.virtualenvs/ponder/lib/python2.7/site-packages/PasteDeploy-1.5.2-py2.7.egg/paste/deploy/loadwsgi.py", line 271, in loadobj
global_conf=global_conf)
File "/home/hughdbrown/.virtualenvs/ponder/lib/python2.7/site-packages/PasteDeploy-1.5.2-py2.7.egg/paste/deploy/loadwsgi.py", line 296, in loadcontext
global_conf=global_conf)
File "/home/hughdbrown/.virtualenvs/ponder/lib/python2.7/site-packages/PasteDeploy-1.5.2-py2.7.egg/paste/deploy/loadwsgi.py", line 320, in _loadconfig
return loader.get_context(object_type, name, …Run Code Online (Sandbox Code Playgroud) 请帮我解决这个错误
我在我的服务器上安装了tensorflow模块,下面是它的信息
15IT60R19@cpusrv-gpu-109:~$ pip show tensorflow
Name: tensorflow
Version: 1.0.0
Summary: TensorFlow helps the tensors flow
Home-page: http://tensorflow.org/
Author: Google Inc.
Author-email: opensource@google.com
License: Apache 2.0
Location: /home/other/15IT60R19/anaconda2/lib/python2.7/site-packages
Requires: mock, numpy, protobuf, wheel, six
Run Code Online (Sandbox Code Playgroud)
但是当我尝试导入tensorflow时,我得到以下错误
>>> import tensorflow as tf
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named tensorflow
Run Code Online (Sandbox Code Playgroud)
我的python版本如下
Python 2.7.12 |Anaconda 2.5.0 (64-bit)| (default, Jul 2 2016, 17:42:40)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux2
Type "help", "copyright", "credits" or …Run Code Online (Sandbox Code Playgroud) 当我!pip install geocoder在Jupyter Notebook中运行时,我获得与pip install geocoder在终端中运行相同的输出,但是当我尝试导入时,地理编码器包不可用.
我正在使用Ubuntu 14.04,Anaconda 4.0.0和pip 8.1.2
安装地理编码器:
!pip install geocoder
The directory '/home/ubuntu/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/ubuntu/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the …Run Code Online (Sandbox Code Playgroud) 我已经成功安装了一个库pip install <library-name>.但是当我尝试导入它时,python会提升ImportError: No module named <library-name>.为什么我会收到此错误,如何使用已安装的库?
python ×9
flask ×2
importerror ×2
pip ×2
alpine-linux ×1
anaconda ×1
centos ×1
centos5 ×1
docker ×1
installation ×1
ipython ×1
jupyter ×1
module ×1
numpy ×1
odoo ×1
opencv ×1
pandas ×1
raspberry-pi ×1
tensorflow ×1